[CalendarServer-changes] [11880] CalendarServer/trunk/txdav/common/datastore/upgrade/sql/upgrades

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 12 11:15:25 PDT 2014


Revision: 11880
          http://trac.calendarserver.org//changeset/11880
Author:   cdaboo at apple.com
Date:     2013-11-02 17:44:10 -0700 (Sat, 02 Nov 2013)
Log Message:
-----------
Handle missing inbox collections.

Modified Paths:
--------------
    CalendarServer/trunk/txdav/common/datastore/upgrade/sql/upgrades/calendar_upgrade_from_3_to_4.py
    CalendarServer/trunk/txdav/common/datastore/upgrade/sql/upgrades/calendar_upgrade_from_4_to_5.py

Modified: CalendarServer/trunk/txdav/common/datastore/upgrade/sql/upgrades/calendar_upgrade_from_3_to_4.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/upgrade/sql/upgrades/calendar_upgrade_from_3_to_4.py	2013-11-02 00:21:16 UTC (rev 11879)
+++ CalendarServer/trunk/txdav/common/datastore/upgrade/sql/upgrades/calendar_upgrade_from_3_to_4.py	2013-11-03 00:44:10 UTC (rev 11880)
@@ -94,27 +94,28 @@
     """
 
     inbox = (yield home.calendarWithName("inbox"))
-    prop = inbox.properties().get(PropertyName.fromElement(propname))
-    if prop is not None:
-        defaultCalendar = str(prop.children[0])
-        parts = defaultCalendar.split("/")
-        if len(parts) == 5:
+    if inbox is not None:
+        prop = inbox.properties().get(PropertyName.fromElement(propname))
+        if prop is not None:
+            defaultCalendar = str(prop.children[0])
+            parts = defaultCalendar.split("/")
+            if len(parts) == 5:
 
-            calendarName = parts[-1]
-            calendarHomeUID = parts[-2]
-            if calendarHomeUID == home.uid():
+                calendarName = parts[-1]
+                calendarHomeUID = parts[-2]
+                if calendarHomeUID == home.uid():
 
-                calendar = (yield home.calendarWithName(calendarName))
-                if calendar is not None:
-                    try:
-                        yield home.setDefaultCalendar(
-                            calendar, tasks=(propname == customxml.ScheduleDefaultTasksURL)
-                        )
-                    except InvalidDefaultCalendar:
-                        # Ignore these - the server will recover
-                        pass
+                    calendar = (yield home.calendarWithName(calendarName))
+                    if calendar is not None:
+                        try:
+                            yield home.setDefaultCalendar(
+                                calendar, tasks=(propname == customxml.ScheduleDefaultTasksURL)
+                            )
+                        except InvalidDefaultCalendar:
+                            # Ignore these - the server will recover
+                            pass
 
-        del inbox.properties()[PropertyName.fromElement(propname)]
+            del inbox.properties()[PropertyName.fromElement(propname)]
 
 
 
@@ -130,15 +131,13 @@
     calendars = (yield home.loadChildren())
     for calendar in calendars:
         if calendar.isInbox():
-            continue
+            prop = calendar.properties().get(PropertyName.fromElement(caldavxml.CalendarFreeBusySet))
+            if prop is not None:
+                del calendar.properties()[PropertyName.fromElement(caldavxml.CalendarFreeBusySet)]
         prop = calendar.properties().get(PropertyName.fromElement(caldavxml.ScheduleCalendarTransp))
         if prop is not None:
             yield calendar.setUsedForFreeBusy(prop == caldavxml.ScheduleCalendarTransp(caldavxml.Opaque()))
             del calendar.properties()[PropertyName.fromElement(caldavxml.ScheduleCalendarTransp)]
-    inbox = (yield home.calendarWithName("inbox"))
-    prop = inbox.properties().get(PropertyName.fromElement(caldavxml.CalendarFreeBusySet))
-    if prop is not None:
-        del inbox.properties()[PropertyName.fromElement(caldavxml.CalendarFreeBusySet)]
 
 
 

Modified: CalendarServer/trunk/txdav/common/datastore/upgrade/sql/upgrades/calendar_upgrade_from_4_to_5.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/upgrade/sql/upgrades/calendar_upgrade_from_4_to_5.py	2013-11-02 00:21:16 UTC (rev 11879)
+++ CalendarServer/trunk/txdav/common/datastore/upgrade/sql/upgrades/calendar_upgrade_from_4_to_5.py	2013-11-03 00:44:10 UTC (rev 11880)
@@ -102,10 +102,11 @@
     the new value from the XML property.
     """
     inbox = (yield home.calendarWithName("inbox"))
-    prop = inbox.properties().get(PropertyName.fromElement(customxml.CalendarAvailability))
-    if prop is not None:
-        yield home.setAvailability(prop.calendar())
-        del inbox.properties()[PropertyName.fromElement(customxml.CalendarAvailability)]
+    if inbox is not None:
+        prop = inbox.properties().get(PropertyName.fromElement(customxml.CalendarAvailability))
+        if prop is not None:
+            yield home.setAvailability(prop.calendar())
+            del inbox.properties()[PropertyName.fromElement(customxml.CalendarAvailability)]
 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/b45e51d8/attachment.html>


More information about the calendarserver-changes mailing list