Exemple #1
0
    def clean_stale_lock(self):
        if self.state != LOCKED:
            return
        mtime = max_column(self.unit_set.all(), "mtime", None)

        if mtime is None:
            # FIXME: we can't tell stale locks if store has no units at all
            return

        delta = mtime.now() - mtime
        if delta.days or delta.seconds > 2 * 60 * 60:
            logging.warning(
                "found stale lock in %s, something went wrong " "with a previous operation on the store",
                self.pootle_path,
            )
            # lock been around for too long, assume it is stale
            if QualityCheck.objects.filter(unit__store=self).exists():
                # there are quality checks, assume we are checked
                self.state = CHECKED
            else:
                # there are units assumed we are parsed
                self.state = PARSED
            return True

        return False
Exemple #2
0
    def get_mtime(self):
        # Putting the next import at the top of the file causes circular import
        # issues.
        from pootle_store.models import Unit

        units = Unit.objects.filter(
            store__pootle_path__startswith=self.pootle_path
        )
        return max_column(units, 'mtime', None)
Exemple #3
0
 def get_mtime(self):
     return max_column(Unit.objects.filter(store__translation_project=self),
                       'mtime', None)
 def max_index(self):
     """Largest unit index"""
     return max_column(self.unit_set.all(), 'index', -1)
 def get_mtime(self):
     return max_column(self.units, 'mtime', None)
Exemple #6
0
 def get_mtime(self):
     project_units = Unit.objects.filter(
             store__translation_project__project=self
     )
     return max_column(project_units, 'mtime', None)
Exemple #7
0
 def get_mtime(self):
     return max_column(Unit.objects.filter(store__pootle_path__startswith=self.pootle_path), 'mtime', None)
Exemple #8
0
 def get_mtime(self):
     return max_column(Unit.objects.filter(store__translation_project=self), "mtime", None)
Exemple #9
0
 def get_mtime(self):
     criteria = {
         'store__pootle_path__startswith': self.pootle_path,
     }
     return max_column(Unit.objects.filter(**criteria), 'mtime', None)
Exemple #10
0
 def get_mtime(self):
     tp_units = Unit.objects.filter(store__translation_project=self)
     return max_column(tp_units, 'mtime', None)
Exemple #11
0
 def get_mtime(self):
     return max_column(Unit.objects.filter(
         store__translation_project__language=self), 'mtime', None)
Exemple #12
0
 def get_mtime(self):
     criteria = {
         'store__pootle_path__startswith': self.pootle_path,
     }
     return max_column(Unit.objects.filter(**criteria), 'mtime', None)
Exemple #13
0
 def get_mtime(self):
     return max_column(self.unit_set.all(), 'mtime', None)
Exemple #14
0
 def get_mtime(self):
     tp_units = Unit.objects.filter(store__translation_project=self)
     return max_column(tp_units, "mtime", None)