mirror of
https://github.com/Kozea/Radicale.git
synced 2025-06-26 16:45:52 +00:00
Only write calendar file when needed (closes bug #192)
This commit is contained in:
parent
076b6b60a4
commit
50e1366e8c
1 changed files with 4 additions and 3 deletions
|
@ -139,9 +139,6 @@ class Calendar(object):
|
||||||
self.encoding = "utf-8"
|
self.encoding = "utf-8"
|
||||||
self.owner = path.split("/")[0]
|
self.owner = path.split("/")[0]
|
||||||
self.path = os.path.join(FOLDER, path.replace("/", os.path.sep))
|
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
|
@staticmethod
|
||||||
def _parse(text, item_types, name=None):
|
def _parse(text, item_types, name=None):
|
||||||
|
@ -286,5 +283,9 @@ class Calendar(object):
|
||||||
The date is formatted according to rfc1123-5.2.14.
|
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))
|
modification_time = time.gmtime(os.path.getmtime(self.path))
|
||||||
return time.strftime("%a, %d %b %Y %H:%M:%S +0000", modification_time)
|
return time.strftime("%a, %d %b %Y %H:%M:%S +0000", modification_time)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue