예제 #1
0
파일: models.py 프로젝트: kant/pootle
    def delete(self, *args, **kwargs):
        directory = self.directory

        super(TranslationProject, self).delete(*args, **kwargs)

        directory.delete()
        deletefromcache(self, ["getquickstats", "getcompletestats", "get_mtime", "get_suggestion_count"])
예제 #2
0
 def delete(self, *args, **kwargs):
     directory = self.directory
     super(TranslationProject, self).delete(*args, **kwargs)
     directory.delete()
     deletefromcache(self, [
         "getquickstats", "getcompletestats", "get_mtime", "has_suggestions"
     ])
예제 #3
0
def update_stats_21060():
    text = """
    <p>%s</p>
    """ %_('Removing potentially incorrect cached stats, will be recalculated...')
    logging.info('flushing cached stats')
    for tp in TranslationProject.objects.filter(stores__unit__state=OBSOLETE).distinct().iterator():
        deletefromcache(tp, ["getquickstats", "getcompletestats", "get_mtime", "has_suggestions"])
    return text
예제 #4
0
파일: models.py 프로젝트: lehmannro/pootle
 def save(self, *args, **kwargs):
     self.pootle_path = self.parent.pootle_path + self.name
     super(Store, self).save(*args, **kwargs)
     if self.state >= PARSED:
         #if self.translation_project:
             # update search index
             #self.translation_project.update_index(self.translation_project.indexer, self)
         # new units, let's flush cache
         deletefromcache(self, ["getquickstats", "getcompletestats", "get_mtime", "has_suggestions"])
예제 #5
0
파일: pootle.py 프로젝트: flok99/pootle
def upgrade_to_21060():
    """Post-upgrade actions for upgrades to 21060."""
    from pootle_misc.util import deletefromcache
    from pootle_store.models import OBSOLETE
    from pootle_translationproject.models import TranslationProject

    logging.info('Flushing cached stats')

    for tp in TranslationProject.objects.filter(stores__unit__state=OBSOLETE) \
                                        .distinct().iterator():
        deletefromcache(tp, ["getquickstats", "getcompletestats", "get_mtime",
                             "has_suggestions"])
예제 #6
0
def update_stats_21060():
    text = """
    <p>%s</p>
    """ % _(
        'Removing potentially incorrect cached stats, will be recalculated...')
    logging.info('flushing cached stats')
    for tp in TranslationProject.objects.filter(
            stores__unit__state=OBSOLETE).distinct().iterator():
        deletefromcache(tp, [
            "getquickstats", "getcompletestats", "get_mtime", "has_suggestions"
        ])
    return text
예제 #7
0
def upgrade_to_21060():
    """Post-upgrade actions for upgrades to 21060."""
    from pootle_misc.util import deletefromcache
    from pootle_store.models import OBSOLETE
    from pootle_translationproject.models import TranslationProject

    logging.info('Flushing cached stats')

    for tp in TranslationProject.objects.filter(stores__unit__state=OBSOLETE) \
                                        .distinct().iterator():
        deletefromcache(tp, [
            "getquickstats", "getcompletestats", "get_mtime", "has_suggestions"
        ])
예제 #8
0
 def save(self, *args, **kwargs):
     self.pootle_path = self.parent.pootle_path + self.name
     super(Store, self).save(*args, **kwargs)
     if hasattr(self, '_units'):
         index = self.max_index() + 1
         for i, unit in enumerate(self._units):
             unit.store = self
             unit.index = index + i
             unit.save()
     if self.state >= PARSED:
         #if self.translation_project:
             # update search index
             #self.translation_project.update_index(self.translation_project.indexer, self)
         # new units, let's flush cache
         deletefromcache(self, ["getquickstats", "getcompletestats", "get_mtime", "has_suggestions"])
예제 #9
0
파일: dbupdate.py 프로젝트: SinSiXX/pootle
def update_stats_21060():
    text = """
    <p>%s</p>
    """ %_('Removing potentially incorrect cached stats, will be '
           'recalculated...')
    logging.info('Flushing cached stats')

    for tp in TranslationProject.objects.filter(stores__unit__state=OBSOLETE) \
                                        .distinct().iterator():
        deletefromcache(tp, ["getquickstats", "getcompletestats",
                             "get_mtime", "has_suggestions"])

    # There's no need to save the schema version here as it will already be
    # saved by :func:`update_tables_22000`
    return text
예제 #10
0
def update_stats_21060():
    text = """
    <p>%s</p>
    """ % _('Removing potentially incorrect cached stats, will be '
            'recalculated...')
    logging.info('Flushing cached stats')

    for tp in TranslationProject.objects.filter(stores__unit__state=OBSOLETE) \
                                        .distinct().iterator():
        deletefromcache(tp, [
            "getquickstats", "getcompletestats", "get_mtime", "has_suggestions"
        ])

    # There's no need to save the schema version here as it will already be
    # saved by :func:`update_tables_22000`
    return text
예제 #11
0
    def save(self, *args, **kwargs):
        if self._source_updated:
            # update source related fields
            self.source_hash = md5_f(self.source_f.encode("utf-8")).hexdigest()
            self.source_wordcount = count_words(self.source_f.strings)
            self.source_length = len(self.source_f)

        if self._target_updated:
            # update target related fields
            self.target_wordcount = count_words(self.target_f.strings)
            self.target_length = len(self.target_f)
            if filter(None, self.target_f.strings):
                if self.state == UNTRANSLATED:
                    self.state = TRANSLATED
            elif self.state > FUZZY:
                self.state = UNTRANSLATED

        super(Unit, self).save(*args, **kwargs)

        if (
            settings.AUTOSYNC
            and self.store.file
            and self.store.state >= PARSED
            and (self._target_updated or self._source_updated)
        ):
            # FIXME: last translator information is lost
            self.sync(self.getorig())
            self.store.update_store_header()
            self.store.file.savestore()

        if self.store.state >= CHECKED and (self._source_updated or self._target_updated):
            # FIXME: are we sure only source and target affect quality checks?
            self.update_qualitychecks()

        # done processing source/target update remove flag
        self._source_updated = False
        self._target_updated = False

        if self.store.state >= PARSED:
            # updated caches
            store = self.store
            # translation_project = store.translation_project
            # translation_project.update_index(
            # translation_project.indexer, store, self.id)
            deletefromcache(store, ["getquickstats", "getcompletestats", "get_mtime", "has_suggestions"])
예제 #12
0
 def require_qualitychecks(self):
     """make sure quality checks are run"""
     if self.state < CHECKED:
         self.update_qualitychecks()
         # new qualitychecks, let's flush cache
         deletefromcache(self, ["getcompletestats"])
예제 #13
0
 def delete(self, *args, **kwargs):
     super(Store, self).delete(*args, **kwargs)
     deletefromcache(self, ["getquickstats", "getcompletestats", "get_mtime", "has_suggestions"])