l.t.s.g.GettextCheckMessages(LaunchpadScript) : class documentation

Part of lp.translations.scripts.gettext_check_messages View In Hierarchy

Run a set of `TranslationMessage`s through gettext checks.

Every translation message that goes into Launchpad is checked, but
since part of the information about the message is in the template
and part is in the translation, there are some scenarios where we
can end up having a message in the database that neither Launchpad
nor gettext would otherwise accept.  For instance, the template may
add a c-format flag after the translation is already accepted, or a
newer gettext version may check for conditions that older versions
let slide.

This script takes a given set of messages (specified as an SQL
"WHERE" clause) and checks each of them.  Messages that are found
faulty are deactivated.
Method add_my_options Optionally customize this hook to define your own options.
Method main Define the meat of your script here. Must be defined.
Method _log_bad_message Report gettext validation error for active message.
Method _check_message_for_error Return error message for translationmessage, if any.
Method _check_and_fix Check message against gettext, and fix it if necessary.
Method _do_commit Commit ongoing transaction, start a new one.
Method _check_transaction_timer Do intermediate commit if needed. Return next commit time.
Method _get_time Read the clock. Tests can replace this with mock clocks.
Method _iterate Go over messages; check and fix them, committing regularly,

Inherited from LaunchpadScript:

Method __init__ Construct new LaunchpadScript.
Method handle_options Undocumented
Method name Enable subclasses to override with command-line arguments.
Method dbuser Enable subclasses to override with command-line arguments.
Method login Super-convenience method that avoids the import.
Method lockfilename Return lockfilename.
Method lockfilepath Undocumented
Method setup_lock Create lockfile.
Method lock_or_die Attempt to lock, and sys.exit(1) if the lock's already taken.
Method unlock Release the lock. Do this before going home.
Method run Actually run the script, executing zcml and initZopeless.
Method record_activity Hook to record script activity.
Method lock_and_run Call lock_or_die(), and then run() the script.
Method _init_zca Initialize the ZCA, this can be overridden for testing purposes.
Method _init_db Initialize the database transaction.
def add_my_options(self):

Optionally customize this hook to define your own options.

This method should contain only a set of lines that follow the template:

self.parser.add_option("-f", "--foo", dest="foo",
default="foobar-makes-the-world-go-round", help="You are joking, right?")
def main(self):
Define the meat of your script here. Must be defined.

Raise LaunchpadScriptFailure if you encounter an error condition that makes it impossible for you to proceed; sys.exit(1) will be invoked in that situation.

def _log_bad_message(self, bad_message, error):
Report gettext validation error for active message.
def _check_message_for_error(self, translationmessage):
Return error message for translationmessage, if any.
ReturnsError message string if there is an error, or None otherwise.
def _check_and_fix(self, translationmessage):
Check message against gettext, and fix it if necessary.
def _do_commit(self):
Commit ongoing transaction, start a new one.
def _check_transaction_timer(self, next_commit):
Do intermediate commit if needed. Return next commit time.
def _get_time(self):
Read the clock. Tests can replace this with mock clocks.
def _iterate(self, messages):
Go over messages; check and fix them, committing regularly,
API Documentation for Launchpad, generated by pydoctor at 2020-08-04 00:00:04.