예제 #1
0
 def _touch_store_cache(self):
     """Update stored mod_info without reparsing file."""
     if hasattr(self, "_store_tuple"):
         mod_info = self.getpomtime()
         if self._store_tuple.mod_info != mod_info:
             self._store_tuple.mod_info = mod_info
             translation_file_updated.send(sender=self, path=self.path)
     else:
         #FIXME: do we really need that?
         self._update_store_cache()
예제 #2
0
 def _touch_store_cache(self):
     """Update stored mod_info without reparsing file."""
     if hasattr(self, "_store_tuple"):
         mod_info = self.getpomtime()
         if self._store_tuple.mod_info != mod_info:
             self._store_tuple.mod_info = mod_info
             translation_file_updated.send(sender=self, path=self.path)
     else:
         #FIXME: do we really need that?
         self._update_store_cache()
예제 #3
0
    def _delete_store_cache(self):
        """Remove translation store from cache."""
        try:
            del self._store_cache[self.path]
        except KeyError:
            pass

        try:
            del self._store_tuple
        except AttributeError:
            pass

        translation_file_updated.send(sender=self, path=self.path)
예제 #4
0
    def _delete_store_cache(self):
        """Remove translation store from cache."""
        try:
            del self._store_cache[self.path]
        except KeyError:
            pass

        try:
            del self._store_tuple
        except AttributeError:
            pass

        translation_file_updated.send(sender=self, path=self.path)
예제 #5
0
 def _update_store_cache(self):
     """Add translation store to dictionary cache, replace old cached
     version if needed."""
     mod_info = self.getpomtime()
     if not hasattr(self, "_store_typle") or self._store_tuple.mod_info != mod_info:
         try:
             self._store_tuple = self._store_cache[self.path]
             if self._store_tuple.mod_info != mod_info:
                 # if file is modified act as if it doesn't exist in cache
                 raise KeyError
         except KeyError:
             logging.debug("cache miss for %s", self.path)
             self._store_tuple = StoreTuple(factory.getobject(self.path, ignore=self.field.ignore, classes=factory_classes),
                                            mod_info, self.realpath)
             self._store_cache[self.path] = self._store_tuple
             translation_file_updated.send(sender=self, path=self.path)
예제 #6
0
 def _update_store_cache(self):
     """Add translation store to dictionary cache, replace old cached
     version if needed."""
     mod_info = self.getpomtime()
     if not hasattr(
             self,
             "_store_typle") or self._store_tuple.mod_info != mod_info:
         try:
             self._store_tuple = self._store_cache[self.path]
             if self._store_tuple.mod_info != mod_info:
                 # if file is modified act as if it doesn't exist in cache
                 raise KeyError
         except KeyError:
             logging.debug(u"cache miss for %s", self.path)
             self._store_tuple = StoreTuple(
                 factory.getobject(self.path,
                                   ignore=self.field.ignore,
                                   classes=factory_classes), mod_info,
                 self.realpath)
             self._store_cache[self.path] = self._store_tuple
             translation_file_updated.send(sender=self, path=self.path)