Ejemplo n.º 1
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]