コード例 #1
0
 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'])
コード例 #2
0
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
コード例 #3
0
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
コード例 #4
0
 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"],
     )
コード例 #5
0
ファイル: statistics.py プロジェクト: pombredanne/launchpad-3
    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()
コード例 #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()