l.b.s.c.base : module documentation

Part of lp.bugs.scripts.checkwatches

Common classes and functions for the checkwatches system.
Function report_oops Record an oops for the current exception.
Function report_warning Create and report a warning as an OOPS.
Class WorkingBase A base class for writing a long-running process.
Function with_interaction Wrap a method to ensure that it runs within an interaction.
Function commit_before Wrap a method to commit any in-progress transactions.
def report_oops(message=None, properties=None, info=None, transaction_manager=None):
Record an oops for the current exception.

This must only be called while handling an exception.

Searches for 'URL', 'url', or 'baseurl' properties, in order of preference, to use as the linked URL of the OOPS report.

Parametersmessagecustom explanatory error message. Do not use str(exception) to fill in this parameter, it should only be set when a human readable error has been explicitly generated.
propertiesProperties to record in the OOPS report. (type: An iterable of (name, value) tuples.)
infoException info. (type: The return value of sys.exc_info().)
transaction_managerA transaction manager. If specified, further commit() calls will be logged.
def report_warning(message, properties=None, info=None, transaction_manager=None):
Create and report a warning as an OOPS.

If no exception info is passed in this will create a generic BugWatchUpdateWarning to record.

ParametersmessageSee report_oops.
propertiesSee report_oops.
infoSee report_oops.
transaction_managerSee report_oops.
def with_interaction(func):
Wrap a method to ensure that it runs within an interaction.

If an interaction is already set up, this simply calls the function. If no interaction exists, it will set one up, call the function, then end the interaction.

This is intended to make sure the right thing happens whether or not the function is run in a different thread.

It's intended for use with WorkingBase, which provides an interaction property; this is the hook that's required.

def commit_before(func):
Wrap a method to commit any in-progress transactions.

This is chiefly intended for use with public-facing methods, so that callers do not need to be responsible for committing before calling them.

It's intended for use with WorkingBase, which provides a _transaction_manager property; this is the hook that's required.

API Documentation for Launchpad, generated by pydoctor at 2018-02-23 00:00:09.