~jcsackett/launchpad/series-need-usage-attributes-643902

« back to all changes in this revision

Viewing changes to lib/lp/translations/model/potmsgset.py

  • Committer: Ian Booth
  • Date: 2010-09-14 21:32:16 UTC
  • mfrom: (11542 launchpad)
  • mto: This revision was merged to the branch mainline in revision 11564.
  • Revision ID: ian.booth@canonical.com-20100914213216-2cg4edr4sbglh1wo
Code review fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
361
361
            query = ["(NOT %s)" % in_use_clause]
362
362
        query.append('TranslationMessage.language = %s' % sqlvalues(language))
363
363
 
 
364
        # XXX j.c.sackett 2010-08-30 bug=627631 Once data migration has
 
365
        # happened for the usage enums, this sql needs to be updated
 
366
        # to check for the translations_usage, not official_rosetta.
364
367
        query.append('''
365
368
            potmsgset IN (
366
369
                SELECT POTMsgSet.id
381
384
                    POTMsgSet.id <> %s AND
382
385
                    msgid_singular = %s AND
383
386
                    POTemplate.iscurrent AND
384
 
                    (Product.official_rosetta OR Distribution.official_rosetta)
 
387
                    (Product.official_rosetta OR
 
388
                        Distribution.official_rosetta)
385
389
            )''' % sqlvalues(self, self.msgid_singular))
386
390
 
387
391
        # Subquery to find the ids of TranslationMessages that are
396
400
            for form in xrange(TranslationConstants.MAX_PLURAL_FORMS)])
397
401
        ids_query_params = {
398
402
            'msgstrs': msgstrs,
399
 
            'where': ' AND '.join(query)
400
 
        }
 
403
            'where': ' AND '.join(query),
 
404
            }
401
405
        ids_query = '''
402
406
            SELECT DISTINCT ON (%(msgstrs)s)
403
407
                TranslationMessage.id
565
569
        # plural forms.
566
570
        order.extend([
567
571
            'msgstr%s NULLS FIRST' % quote(form)
568
 
            for form in remaining_plural_forms
569
 
            ])
 
572
            for form in remaining_plural_forms])
570
573
        matches = list(
571
574
            TranslationMessage.select(' AND '.join(clauses), orderBy=order))
572
575
 
722
725
        if is_imported or new_message == imported_message:
723
726
            new_message.is_imported = True
724
727
 
725
 
 
726
728
    def _isTranslationMessageASuggestion(self, force_suggestion,
727
729
                                         pofile, submitter,
728
730
                                         force_edition_rights, is_imported,
1178
1180
        """See `IPOTMsgSet`."""
1179
1181
        return TranslationTemplateItem.selectBy(
1180
1182
            potmsgset=self, orderBy=['id'])
1181