Просмотр исходного кода

Fix the owner attribution of calendars

Guillaume Ayoub 14 лет назад
Родитель
Сommit
6bbf3f624f
1 измененных файлов с 6 добавлено и 2 удалено
  1. 6 2
      radicale/ical.py

+ 6 - 2
radicale/ical.py

@@ -171,11 +171,15 @@ class Calendar(object):
         """
         self.encoding = "utf-8"
         split_path = path.split("/")
-        if (principal and split_path) or len(split_path) > 1:
+        self.path = os.path.join(FOLDER, path.replace("/", os.sep))
+        if principal and split_path and os.path.isdir(self.path):
+            # Already existing principal calendar
             self.owner = split_path[0]
+        elif len(split_path) > 1:
+            # URL with at least one folder
+            self.owner = split_path[-1]
         else:
             self.owner = None
-        self.path = os.path.join(FOLDER, path.replace("/", os.sep))
         self.local_path = path if path != '.' else ''
         self.is_principal = principal