l.t.m.distroseries_translations_copy : module documentation

Part of lp.translations.model

Functions to copy translations from one distroseries to another.
Function omit_redundant_pofiles Batch-pouring callback: skip POFiles that have become redundant.
Function copy_active_translations Populate target DistroSeries with source series' translations.
def omit_redundant_pofiles(from_table, to_table, batch_size, begin_id, end_id):
Batch-pouring callback: skip POFiles that have become redundant.

This is needed to deal with a concurrency problem where POFiles may get created (through message sharing) while translations are still being copied.

def copy_active_translations(source, target, transaction, logger, sourcepackagenames=None, skip_duplicates=False):
Populate target DistroSeries with source series' translations.

The target must not already have any translations.

This method uses MultiTableCopy to copy data.

Translation data for the new series ("target") is first copied into holding tables called e.g. "temp_POTemplate_holding_ubuntu_feisty" and processed there. Then, near the end of the procedure, the contents of these holding tables are all poured back into the original tables.

If this procedure fails, it may leave holding tables behind. This was done deliberately to leave some forensics information for failures, and also to allow admins to see what data has and has not been copied.

If a holding table left behind by an abortive run has a column called new_id at the end, it contains unfinished data and may as well be dropped. If it does not have that column, the holding table was already in the process of being poured back into its source table. In that case the sensible thing to do is probably to continue pouring it.

API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.