[CalendarServer-changes] [3102] CalendarServer/trunk/twistedcaldav/scheduling

source_changes at macosforge.org source_changes at macosforge.org
Thu Oct 2 11:31:04 PDT 2008


Revision: 3102
          http://trac.macosforge.org/projects/calendarserver/changeset/3102
Author:   cdaboo at apple.com
Date:     2008-10-02 11:31:03 -0700 (Thu, 02 Oct 2008)
Log Message:
-----------
Add some useful debug logging.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py
    CalendarServer/trunk/twistedcaldav/scheduling/itip.py

Modified: CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py	2008-10-02 17:35:47 UTC (rev 3101)
+++ CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py	2008-10-02 18:31:03 UTC (rev 3102)
@@ -19,6 +19,7 @@
 from twistedcaldav.scheduling.itip import iTipGenerator
 
 from vobject.icalendar import dateTimeToString
+from difflib import unified_diff
 
 """
 Class that handles diff'ing two calendar objects.
@@ -100,17 +101,20 @@
         
         # Make sure the same VCALENDAR properties match
         if not self._checkVCALENDARProperties():
-            log.debug("attendeeMerge: VCALENDAR properties do not match")
+            self._logDiffError("attendeeMerge: VCALENDAR properties do not match")
             return False, False
         
         # Make sure the same VTIMEZONE components appear
         if not self._compareVTIMEZONEs():
-            log.debug("attendeeMerge: VTIMEZONEs do not match")
+            self._logDiffError("attendeeMerge: VTIMEZONEs do not match")
             return False, False
         
         # Compare each component instance from the new calendar with each derived
         # component instance from the old one
-        return self._compareComponents()
+        result = self._compareComponents()
+        if not result[0]:
+            self._logDiffError("attendeeMerge: Mismatched calendar objects")
+        return result
     
     def whatIsDifferent(self):
         """
@@ -332,3 +336,13 @@
         if regular_changes or done_attendee or done_partstat:
             rid = comp1.getRecurrenceIDUTC()
             rids.add(dateTimeToString(rid) if rid is not None else "")
+
+    def _logDiffError(self, title):
+
+        diff = "\n".join(unified_diff(
+            str(self.calendar1).split("\n"),
+            str(self.calendar2).split("\n"),
+            fromfile='Existing Calendar Object',
+            tofile='New Calendar Object',
+        ))
+        log.debug("%s:\n%s" % (title, diff,))

Modified: CalendarServer/trunk/twistedcaldav/scheduling/itip.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/itip.py	2008-10-02 17:35:47 UTC (rev 3101)
+++ CalendarServer/trunk/twistedcaldav/scheduling/itip.py	2008-10-02 18:31:03 UTC (rev 3102)
@@ -295,7 +295,7 @@
 
         # Get attendee in from_component - there MUST be only one
         attendees = tuple(from_component.properties("ATTENDEE"))
-        assert len(attendees) == 1, "There must be one and only one ATTENDEE property in a REPLY"
+        assert len(attendees) == 1, "There must be one and only one ATTENDEE property in a REPLY\n%s" % (str(from_component),)
         attendee = attendees[0]
         partstat = attendee.params().get("PARTSTAT", ("NEEDS-ACTION",))[0]
         
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20081002/c0c26dab/attachment.html 


More information about the calendarserver-changes mailing list