From 50e1366e8cfa4232cf646e56cdb5ff1a7508104b Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Thu, 11 Nov 2010 21:46:13 +0100 Subject: [PATCH] Only write calendar file when needed (closes bug #192) --- radicale/ical.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/radicale/ical.py b/radicale/ical.py index 677bb844..d7ab4b50 100644 --- a/radicale/ical.py +++ b/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)