Fix the iCal support (now tested with iCal, Lightning, Evolution)

This commit is contained in:
Guillaume Ayoub
2011-07-01 17:49:01 +02:00
parent d17e8fa990
commit e9ad9b1716
3 changed files with 14 additions and 14 deletions

View File

@ -192,12 +192,12 @@ class Calendar(object):
attributes = posixpath.normpath(path).strip("/").split("/")
if not attributes:
return None
if attributes[-1].endswith(".ics"):
if not (os.path.isfile(os.path.join(FOLDER, *attributes)) or path.endswith("/")):
attributes.pop()
result = []
path = "/".join(attributes[:min(len(attributes), 2)])
path = "/".join(attributes)
abs_path = os.path.join(FOLDER, path.replace("/", os.sep))
if os.path.isdir(abs_path):
if depth == "0":
@ -213,10 +213,10 @@ class Calendar(object):
# Directory does not exist yet
pass
else:
calendar = cls(path)
if depth == "0":
result.append(calendar)
result.append(cls(path))
else:
calendar = cls(path, principal=True)
if include_container:
result.append(calendar)
result.extend(calendar.components)