Procházet zdrojové kódy

Only relevant files for last_modified calculation

Leftovers from failed transactions etc. should not change that property.
Unrud před 9 roky
rodič
revize
de09f6689a
1 změnil soubory, kde provedl 6 přidání a 3 odebrání
  1. 6 3
      radicale/storage.py

+ 6 - 3
radicale/storage.py

@@ -686,9 +686,12 @@ class Collection(BaseCollection):
 
     @property
     def last_modified(self):
-        last = max([os.path.getmtime(self._filesystem_path)] + [
-            os.path.getmtime(os.path.join(self._filesystem_path, filename))
-            for filename in os.listdir(self._filesystem_path)] or [0])
+        relevant_files = [self._filesystem_path] + [
+            path_to_filesystem(self._filesystem_path, href)
+            for href in self.list()]
+        if os.path.exists(self._props_path):
+            relevant_files.append(self._props_path)
+        last = max(map(os.path.getmtime, relevant_files))
         return time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime(last))
 
     def serialize(self):