~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/translations/translationmerger.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-09-12 18:11:42 UTC
  • mfrom: (13901.2.2 perm-845803)
  • Revision ID: launchpad@pqm.canonical.com-20110912181142-fnn8de7d1cq3ra9r
[r=julian-edwards][bug=845803] Remove call to
        canSetEnabledRestrictedFamilies

Show diffs side-by-side

added added

removed removed

Lines of Context:
387
387
            merger = cls(templates, tm)
388
388
            merger.mergePOTMsgSets()
389
389
 
 
390
    @classmethod
 
391
    def mergeModifiedTemplates(cls, potemplate, tm):
 
392
        subset = getUtility(IPOTemplateSet).getSharingSubset(
 
393
            distribution=potemplate.distribution,
 
394
            sourcepackagename=potemplate.sourcepackagename,
 
395
            product=potemplate.product)
 
396
        templates = list(subset.getSharingPOTemplates(potemplate.name))
 
397
        templates.sort(key=methodcaller('sharingKey'), reverse=True)
 
398
        merger = cls(templates, tm)
 
399
        merger.mergeAll()
 
400
 
 
401
    def mergeAll(self):
 
402
        """Properly merge POTMsgSets and TranslationMessages."""
 
403
        self._removeDuplicateMessages()
 
404
        self.tm.endTransaction(intermediate=True)
 
405
        self.mergePOTMsgSets()
 
406
        self.tm.endTransaction(intermediate=True)
 
407
        self.mergeTranslationMessages()
 
408
        self.tm.endTransaction()
 
409
 
390
410
    def __init__(self, potemplates, tm):
391
411
        """Constructor.
392
412
 
548
568
            deletions = 0
549
569
            order_check.check(template)
550
570
            potmsgset_ids = self._getPOTMsgSetIds(template)
551
 
            total_ids = len(potmsgset_ids)
552
571
            for potmsgset_id in potmsgset_ids:
553
572
                potmsgset = POTMsgSet.get(potmsgset_id)
554
573