Пример #1
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()
Пример #2
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()
Пример #3
0
    def _resetReferences(self):
        """Reset translation-related references in the test object.

        This stops the test itself from pinning things in memory as
        caches are cleared.

        Transactions are committed and the templates list is discarded
        and rebuilt to get rid of pinned objects.
        """
        if self.templates is None:
            template_ids = []
        else:
            template_ids = [template.id for template in self.templates]

        self.templates = None
        self.trunk_potmsgset = None
        self.stable_potmsgset = None
        self.msgid = None
        self.trunk_pofile = None
        self.stable_pofile = None
        self._flushDbObjects()

        self.templates = [POTemplate.get(id) for id in template_ids]
    def _resetReferences(self):
        """Reset translation-related references in the test object.

        This stops the test itself from pinning things in memory as
        caches are cleared.

        Transactions are committed and the templates list is discarded
        and rebuilt to get rid of pinned objects.
        """
        if self.templates is None:
            template_ids = []
        else:
            template_ids = [template.id for template in self.templates]

        self.templates = None
        self.trunk_potmsgset = None
        self.stable_potmsgset = None
        self.msgid = None
        self.trunk_pofile = None
        self.stable_pofile = None
        self._flushDbObjects()

        self.templates = [POTemplate.get(id) for id in template_ids]
Пример #5
0
 def getPOTemplate(self, name):
     """See IProductSeries."""
     return POTemplate.selectOne(
         "productseries = %s AND name = %s" % sqlvalues(self.id, name))