[CalendarServer-changes] [6265] CalDAVTester/trunk/verifiers/calendarDataMatch.py

source_changes at macosforge.org source_changes at macosforge.org
Thu Sep 9 13:29:17 PDT 2010


Revision: 6265
          http://trac.macosforge.org/projects/calendarserver/changeset/6265
Author:   cdaboo at apple.com
Date:     2010-09-09 13:29:16 -0700 (Thu, 09 Sep 2010)
Log Message:
-----------
Sort components by UID/RID before comparing.

Modified Paths:
--------------
    CalDAVTester/trunk/verifiers/calendarDataMatch.py

Modified: CalDAVTester/trunk/verifiers/calendarDataMatch.py
===================================================================
--- CalDAVTester/trunk/verifiers/calendarDataMatch.py	2010-09-09 19:26:54 UTC (rev 6264)
+++ CalDAVTester/trunk/verifiers/calendarDataMatch.py	2010-09-09 20:29:16 UTC (rev 6265)
@@ -102,17 +102,39 @@
                     if tzinfo:
                         component.tzinfo = tzinfo
 
+        def sortComponents(calobj):
+            for compType in ('vevent', 'vtodo', 'vjournal', 'vavailability'):
+                try:
+                    comps = calobj.contents[compType]
+                    
+                    def _key(comp):
+                        try:
+                            uid = comp.contents['uid'][0].valueRepr()
+                        except KeyError:
+                            uid = ""
+                        try:
+                            rid = comp.contents['recurrence-id'][0].valueRepr()
+                        except KeyError:
+                            rid = ""
+                        return uid + ":" + rid
+        
+                    comps.sort(key=_key)
+                except KeyError:
+                    pass
+
         s = StringIO.StringIO(respdata)
         try:
             resp_calendar = readOne(s)
             removePropertiesParameters(resp_calendar)
             normalizeRRULE(resp_calendar)
+            sortComponents(resp_calendar)
             respdata = resp_calendar.serialize()
             
             s = StringIO.StringIO(data)
             data_calendar = readOne(s)
             removePropertiesParameters(data_calendar)
             normalizeRRULE(data_calendar)
+            sortComponents(data_calendar)
             data = data_calendar.serialize()
             
             result = respdata == data
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100909/ec0a07b6/attachment.html>


More information about the calendarserver-changes mailing list