Create the directory structure if none found.
This commit is contained in:
parent
3bc3574105
commit
537d6b6fd2
@ -185,16 +185,20 @@ class Calendar(object):
|
||||
path = "/".join(attributes[:min(len(attributes), 2)])
|
||||
path = path.replace("/", os.sep)
|
||||
abs_path = os.path.join(FOLDER, path)
|
||||
if os.path.isdir(abs_path):
|
||||
if os.path.isdir(abs_path) or len(attributes) == 1:
|
||||
if depth == "0":
|
||||
result.append(cls(path, principal=True))
|
||||
else:
|
||||
if include_container:
|
||||
result.append(cls(path, principal=True))
|
||||
for f in next(os.walk(abs_path))[2]:
|
||||
f_path = os.path.join(path, f)
|
||||
if cls.is_vcalendar(os.path.join(abs_path, f)):
|
||||
result.append(cls(f_path))
|
||||
try:
|
||||
for f in next(os.walk(abs_path))[2]:
|
||||
f_path = os.path.join(path, f)
|
||||
if cls.is_vcalendar(os.path.join(abs_path, f)):
|
||||
result.append(cls(f_path))
|
||||
except StopIteration:
|
||||
# directory does not exist yet
|
||||
pass
|
||||
else:
|
||||
calendar = cls(path)
|
||||
if depth == "0":
|
||||
@ -284,6 +288,8 @@ class Calendar(object):
|
||||
|
||||
def write(self, headers=None, items=None):
|
||||
"""Write calendar with given parameters."""
|
||||
if self.is_principal:
|
||||
return
|
||||
headers = headers or self.headers or (
|
||||
Header("PRODID:-//Radicale//NONSGML Radicale Server//EN"),
|
||||
Header("VERSION:2.0"))
|
||||
|
Loading…
Reference in New Issue
Block a user