Преглед изворни кода

Only write calendar file when needed (closes bug #192)

Guillaume Ayoub пре 15 година
родитељ
комит
50e1366e8c
1 измењених фајлова са 4 додато и 3 уклоњено
  1. 4 3
      radicale/ical.py

+ 4 - 3
radicale/ical.py

@@ -139,9 +139,6 @@ class Calendar(object):
         self.encoding = "utf-8"
         self.owner = path.split("/")[0]
         self.path = os.path.join(FOLDER, path.replace("/", os.path.sep))
-        # Create calendar if needed, useful for ``self.last_modified``
-        if not os.path.exists(self.path):
-            self.write()
 
     @staticmethod
     def _parse(text, item_types, name=None):
@@ -286,5 +283,9 @@ class Calendar(object):
         The date is formatted according to rfc1123-5.2.14.
 
         """
+        # Create calendar if needed
+        if not os.path.exists(self.path):
+            self.write()
+
         modification_time = time.gmtime(os.path.getmtime(self.path))
         return time.strftime("%a, %d %b %Y %H:%M:%S +0000", modification_time)