Part of lp.translations.scripts
POFileTranslator more or less consistent with the real data.| Function | get_pofile_ids | Retrieve ids of POFiles to scrub. |
| Function | summarize_pofiles | Retrieve relevant parts of `POFile`s with given ids. |
| Function | get_potmsgset_ids | Get the ids for each current POTMsgSet in a POTemplate. |
| Function | summarize_contributors | Return the set of ids of persons who contributed to a POFile. |
| Function | get_contributions | Map all users' most recent contributions to a POFile. |
| Function | get_pofiletranslators | Get Person ids from POFileTranslator entries for a POFile. |
| Function | remove_pofiletranslators | Delete POFileTranslator records. |
| Function | remove_unwarranted_pofiletranslators | Delete POFileTranslator records that shouldn't be there. |
| Function | create_missing_pofiletranslators | Create POFileTranslator records that were missing. |
| Function | fix_pofile | This POFile needs fixing. Load its data & fix it. |
| Function | needs_fixing | Does the POFile with given details need POFileTranslator changes? |
| Function | gather_work_items | Produce `WorkItem`s for those `POFile`s that need fixing. |
| Function | preload_work_items | Bulk load data that will be needed to process work_items. |
| Function | process_work_items | Fix the POFileTranslator records covered by work_items. |
| Class | ScrubPOFileTranslator | Tunable loop, meant for running from inside Garbo. |
The result's ordering is aimed at maximizing cache effectiveness: by POTemplate name for locality of shared POTMsgSets, and by language for locality of shared TranslationMessages.
Retrieve relevant parts of `POFile`s with given ids.
This gets just enough information to determine whether any of the
`POFile`s need their `POFileTranslator` records fixed.
:param pofile_ids: Iterable of `POFile` ids.
:return: Dict mapping each id in `pofile_ids` to a duple of
`POTemplate` id and `Language` id for the associated `POFile`.
POFile.
This is a limited version of get_contributions that is easier to
compute.
POFile.
Returns a dict mapping Person id to the creation time of their most
recent TranslationMessage in POFile.
This leaves some small room for error: a contribution that is masked by a diverged entry in this POFile will nevertheless produce a POFileTranslator record. Fixing that would complicate the work more than it is probably worth.
| Parameters | pofile | The POFile to find contributions for. |
| potmsgset_ids | The ids of the POTMsgSet`s to look for, as returned
by `get_potmsgset_ids. |
POFileTranslator records that shouldn't be there.POFileTranslator records that were missing.POFile needs fixing. Load its data & fix it.POFile with given details need POFileTranslator changes?| Parameters | template_id | id of the POTemplate for the POFile. |
| language_id | id of the Language the POFile translates to. | |
| potmsgset_ids | ids of the POTMsgSet items participating in the
template. | |
| pofiletranslators | POFileTranslator objects for the POFile. | |
| Returns | Bool: does the existing set of POFileTranslator need fixing? | |
Produce `WorkItem`s for those `POFile`s that need fixing. :param pofile_ids: An iterable of `POFile` ids to check. :param pofile_summaries: Dict as returned by `summarize_pofiles`. :return: A sequence of `WorkItem`s for those `POFile`s that need fixing.