def pofiles(self):
     return POFile.select('''
         POFile.language = %s AND
         POFile.potemplate = POTemplate.id AND
         POTemplate.distroseries = %s AND
         POTemplate.iscurrent = TRUE
         ''' % sqlvalues(self.language.id, self.distroseries.id),
         clauseTables=['POTemplate'],
         prejoins=["potemplate.sourcepackagename"],
         orderBy=['-POTemplate.priority', 'POFile.id'])
def fix_plurals_in_all_pofiles(ztm, logger):
    """Go through all PO files and fix plural forms if needed."""

    cur = cursor()
    cur.execute("""SELECT MAX(id) FROM POFile""")
    (max_pofile_id,) = cur.fetchall()[0]
    for pofile_id in range(1, max_pofile_id):
        try:
            pofile = POFile.get(pofile_id)
            fix_pofile_plurals(pofile, logger, ztm)
        except SQLObjectNotFound:
            pass
def fix_plurals_in_all_pofiles(ztm, logger):
    """Go through all PO files and fix plural forms if needed."""

    cur = cursor()
    cur.execute("""SELECT MAX(id) FROM POFile""")
    (max_pofile_id, ) = cur.fetchall()[0]
    for pofile_id in range(1, max_pofile_id):
        try:
            pofile = POFile.get(pofile_id)
            fix_pofile_plurals(pofile, logger, ztm)
        except SQLObjectNotFound:
            pass
 def pofiles(self):
     return POFile.select(
         """
         POFile.language = %s AND
         POFile.potemplate = POTemplate.id AND
         POTemplate.distroseries = %s AND
         POTemplate.iscurrent = TRUE
         """
         % sqlvalues(self.language.id, self.distroseries.id),
         clauseTables=["POTemplate"],
         prejoins=["potemplate.sourcepackagename"],
         orderBy=["-POTemplate.priority", "POFile.id"],
     )
Example #5
0
    def _updateRosettaStatistics(self, ztm):
        self.update(
                'products_using_rosetta',
                Product.selectBy(
                    translations_usage=ServiceUsage.LAUNCHPAD).count())
        self.update('potemplate_count', POTemplate.select().count())
        ztm.commit()
        self.update('pofile_count', POFile.select().count())
        ztm.commit()
        self.update('pomsgid_count', POMsgID.select().count())
        ztm.commit()
        self.update('language_count', Language.select(
            "POFile.language=Language.id",
            clauseTables=['POFile'],
            distinct=True).count())
        ztm.commit()

        cur = cursor()
        cur.execute(
            "SELECT COUNT(DISTINCT submitter) FROM TranslationMessage")
        self.update('translator_count', cur.fetchone()[0] or 0)
        ztm.commit()

        cur = cursor()
        cur.execute("""
            SELECT COUNT(DISTINCT submitter)
            FROM TranslationMessage
            WHERE origin=2
            """)
        self.update('rosetta_translator_count', cur.fetchone()[0] or 0)
        ztm.commit()

        cur = cursor()
        cur.execute("""
            SELECT COUNT(DISTINCT product) FROM ProductSeries,POTemplate
            WHERE ProductSeries.id = POTemplate.productseries
            """)
        self.update('products_with_potemplates', cur.fetchone()[0] or 0)
        ztm.commit()
Example #6
0
    def _updateRosettaStatistics(self, ztm):
        self.update(
                'products_using_rosetta',
                Product.selectBy(
                    translations_usage=ServiceUsage.LAUNCHPAD).count())
        self.update('potemplate_count', POTemplate.select().count())
        ztm.commit()
        self.update('pofile_count', POFile.select().count())
        ztm.commit()
        self.update('pomsgid_count', POMsgID.select().count())
        ztm.commit()
        self.update('language_count', Language.select(
            "POFile.language=Language.id",
            clauseTables=['POFile'],
            distinct=True).count())
        ztm.commit()

        cur = cursor()
        cur.execute(
            "SELECT COUNT(DISTINCT submitter) FROM TranslationMessage")
        self.update('translator_count', cur.fetchone()[0] or 0)
        ztm.commit()

        cur = cursor()
        cur.execute("""
            SELECT COUNT(DISTINCT submitter)
            FROM TranslationMessage
            WHERE origin=2
            """)
        self.update('rosetta_translator_count', cur.fetchone()[0] or 0)
        ztm.commit()

        cur = cursor()
        cur.execute("""
            SELECT COUNT(DISTINCT product) FROM ProductSeries,POTemplate
            WHERE ProductSeries.id = POTemplate.productseries
            """)
        self.update('products_with_potemplates', cur.fetchone()[0] or 0)
        ztm.commit()