[CalendarServer-changes] [4819] CalendarServer/branches/users/cdaboo/implicit-improvements-4804/ twistedcaldav/scheduling

source_changes at macosforge.org source_changes at macosforge.org
Fri Dec 4 11:34:11 PST 2009


Revision: 4819
          http://trac.macosforge.org/projects/calendarserver/changeset/4819
Author:   cdaboo at apple.com
Date:     2009-12-04 11:34:07 -0800 (Fri, 04 Dec 2009)
Log Message:
-----------
Eliminate most of the attendeeMerge 403's.

Modified Paths:
--------------
    CalendarServer/branches/users/cdaboo/implicit-improvements-4804/twistedcaldav/scheduling/icaldiff.py
    CalendarServer/branches/users/cdaboo/implicit-improvements-4804/twistedcaldav/scheduling/test/test_icaldiff.py

Modified: CalendarServer/branches/users/cdaboo/implicit-improvements-4804/twistedcaldav/scheduling/icaldiff.py
===================================================================
--- CalendarServer/branches/users/cdaboo/implicit-improvements-4804/twistedcaldav/scheduling/icaldiff.py	2009-12-03 22:08:41 UTC (rev 4818)
+++ CalendarServer/branches/users/cdaboo/implicit-improvements-4804/twistedcaldav/scheduling/icaldiff.py	2009-12-04 19:34:07 UTC (rev 4819)
@@ -303,7 +303,7 @@
                         break
                 else:
                     # Nothing matches - this has to be treated as an error
-                    log.debug("attendeeMerge: Unable to match fake master component: %s" % (keynew,))
+                    self._logDiffError("attendeeMerge: Unable to match fake master component: %s" % (keynew,))
                     return False, False, (), None
             else:
                 componentold = self.oldcalendar.overriddenComponent(masternewStart)
@@ -355,29 +355,38 @@
             componentnew = mapnew[key]
             if componentnew.propertyValue("STATUS") == "CANCELLED":
                 if exdatesold is None or rid not in exdatesold:
-                    log.debug("attendeeMerge: Cancelled component not found in first calendar (or no EXDATE): %s" % (key,))
-                    return False, False, (), None
+                    # We used to generate a 403 here - but instead we now ignore this error and let the server data
+                    # override the client
+                    self._logDiffError("attendeeMerge: Cancelled component not found in first calendar (or no EXDATE): %s" % (key,))
+                    setnew.remove(key)
                 else:
                     # Derive new component with STATUS:CANCELLED and remove EXDATE
                     newOverride = self.newCalendar.deriveInstance(rid, allowCancelled=True)
                     if newOverride is None:
-                        log.debug("attendeeMerge: Could not derive instance for cancelled component: %s" % (key,))
-                        return False, False, (), None
-                    self.newCalendar.addComponent(newOverride)
+                        # We used to generate a 403 here - but instead we now ignore this error and let the server data
+                        # override the client
+                        self._logDiffError("attendeeMerge: Could not derive instance for cancelled component: %s" % (key,))
+                        setnew.remove(key)
+                    else:
+                        self.newCalendar.addComponent(newOverride)
             else:
                 # Derive new component
                 newOverride = self.newCalendar.deriveInstance(rid)
                 if newOverride is None:
-                    log.debug("attendeeMerge: Could not derive instance for uncancelled component: %s" % (key,))
-                    return False, False, (), None
-                self.newCalendar.addComponent(newOverride)
+                    # We used to generate a 403 here - but instead we now ignore this error and let the server data
+                    # override the client
+                    self._logDiffError("attendeeMerge: Could not derive instance for uncancelled component: %s" % (key,))
+                    setnew.remove(key)
+                else:
+                    self.newCalendar.addComponent(newOverride)
 
         # So now newCalendar has all the same components as set2. Check changes and do transfers.
         
         # Make sure the same VCALENDAR properties match
         if not self._checkVCALENDARProperties(self.newCalendar, self.newcalendar):
+            # We used to generate a 403 here - but instead we now ignore this error and let the server data
+            # override the client
             self._logDiffError("attendeeMerge: VCALENDAR properties do not match")
-            return False, False, (), None
 
         # Now we transfer per-Attendee
         # data from newcalendar into newCalendar to sync up changes, whilst verifying that other
@@ -390,8 +399,10 @@
             
             allowed, reply = self._transferAttendeeData(serverData, clientData, declines)
             if not allowed:
+                # We used to generate a 403 here - but instead we now ignore this error and let the server data
+                # override the client
                 self._logDiffError("attendeeMerge: Mismatched calendar objects")
-                return False, False, (), None
+                #return False, False, (), None
             changeCausesReply |= reply
             if reply:
                 changedRids.append(toString(rid) if rid else "")
@@ -407,7 +418,7 @@
                         changeCausesReply = True
                         changedRids.append(toString(decline) if decline else "")
                 else:
-                    log.debug("Unable to override and instance to mark as DECLINED: %s" % (decline,))
+                    self._logDiffError("attendeeMerge: Unable to override an instance to mark as DECLINED: %s" % (decline,))
                     return False, False, (), None
 
         return True, changeCausesReply, changedRids, self.newCalendar
@@ -430,9 +441,9 @@
 
     def _transferAttendeeData(self, serverComponent, clientComponent, declines):
         
-        # First check validity of date-time related properties
-        if not self._checkInvalidChanges(serverComponent, clientComponent, declines):
-            return False, False
+        # We are skipping this check now - instead we let the server data override the broken client data
+        # First check validity of date-time related properties and get removed components which are declines
+        self._checkInvalidChanges(serverComponent, clientComponent, declines)
         
         # Now look for items to transfer from one to the other.
         # We care about the ATTENDEE's PARTSTAT, TRANSP, VALARMS, X-APPLE-NEEDS-REPLY,
@@ -462,9 +473,8 @@
         self._transferProperty("LAST-MODIFIED", serverComponent, clientComponent)
         self._transferProperty("X-APPLE-NEEDS-REPLY", serverComponent, clientComponent)
         
-        # Dropbox
-        if not self._transferDropBoxData(serverComponent, clientComponent):
-            return False, False
+        # Dropbox - this now never returns false
+        self._transferDropBoxData(serverComponent, clientComponent)
 
         # Handle VALARMs
         serverComponent.removeAlarms()
@@ -483,14 +493,14 @@
         if not clientDropbox:
             return True
         elif not serverDropbox:
-            # Attendee not allowed to add a dropbox
-            log.debug("Attendee not allowed to add dropbox: %s" % (clientDropbox,))
-            return False
+            # Attendee not allowed to add a dropbox - ignore this
+            self._logDiffError("Attendee not allowed to add dropbox: %s" % (clientDropbox,))
+            return True
         else:
-            # Values must be the same
+            # Values must be the same - ignore this
             if serverDropbox != clientDropbox:
-                log.debug("Attendee not allowed to change dropbox from: %s to: %s" % (serverDropbox, clientDropbox,))
-                return False
+                self._logDiffError("Attendee not allowed to change dropbox from: %s to: %s" % (serverDropbox, clientDropbox,))
+                return True
 
             # Remove existing ATTACH's from server
             for attachment in tuple(serverComponent.properties("ATTACH")):
@@ -731,6 +741,11 @@
 %s
 """ % (title, strcal1, strcal2, strdiff,)
 
-        loggedName = accounting.emitAccounting("Implicit Errors", self.oldcalendar.resourceUID().encode("base64")[:-1], logstr)
+        loggedUID = self.oldcalendar.resourceUID()
+        if loggedUID:
+            loggedUID = loggedUID.encode("base64")[:-1]
+        else:
+            loggedUID = "Unknown"
+        loggedName = accounting.emitAccounting("Implicit Errors", loggedUID, logstr)
         if loggedName:
             log.err("Generating Implicit Error accounting at path: %s" % (loggedName,))

Modified: CalendarServer/branches/users/cdaboo/implicit-improvements-4804/twistedcaldav/scheduling/test/test_icaldiff.py
===================================================================
--- CalendarServer/branches/users/cdaboo/implicit-improvements-4804/twistedcaldav/scheduling/test/test_icaldiff.py	2009-12-03 22:08:41 UTC (rev 4818)
+++ CalendarServer/branches/users/cdaboo/implicit-improvements-4804/twistedcaldav/scheduling/test/test_icaldiff.py	2009-12-04 19:34:07 UTC (rev 4819)
@@ -594,7 +594,19 @@
 END:VCALENDAR
 """,
                 "mailto:user2 at example.com",
-                (False, False, (), None)
+                (True, False, (), """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+DTSTART:20080601T120000Z
+DTEND:20080601T130000Z
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:mailto:user2 at example.com
+ORGANIZER;CN=User 01:mailto:user1 at example.com
+END:VEVENT
+END:VCALENDAR
+""")
             ),
             (
                 "#1.4 Simple component, valarm change",
@@ -753,7 +765,24 @@
 END:VCALENDAR
 """,
                 "mailto:user2 at example.com",
-                (False, False, (), None)
+                (True, False, (), """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+DTSTART:20080601T120000Z
+DTEND:20080601T130000Z
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:mailto:user2 at example.com
+ORGANIZER;CN=User 01:mailto:user1 at example.com
+BEGIN:VALARM
+ACTION:DISPLAY
+DESCRIPTION:Test for Attendee
+TRIGGER;RELATED=START:-PT10M
+END:VALARM
+END:VEVENT
+END:VCALENDAR
+""")
             ),
             (
                 "#1.7 Simple component, vtimezone no change",
@@ -917,7 +946,37 @@
 END:VCALENDAR
 """,
                 "mailto:user2 at example.com",
-                (False, False, (), None)
+                (True, False, (), """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VTIMEZONE
+TZID:US-Eastern
+LAST-MODIFIED:20040110T032845Z
+BEGIN:STANDARD
+DTSTART:19901026T060000
+RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
+TZNAME:EST
+TZOFFSETFROM:-0400
+TZOFFSETTO:-0500
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:19900404T010000
+RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
+TZNAME:EDT
+TZOFFSETFROM:-0500
+TZOFFSETTO:-0400
+END:DAYLIGHT
+END:VTIMEZONE
+BEGIN:VEVENT
+UID:12345-67890
+DTSTART;TZID=US-Eastern:20080601T120000
+DTEND;TZID=US-Eastern:20080601T130000
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:mailto:user2 at example.com
+ORGANIZER;CN=User 01:mailto:user1 at example.com
+END:VEVENT
+END:VCALENDAR
+""")
             ),
             (
                 "#1.9 Simple component, vtimezone substitute",
@@ -1323,7 +1382,28 @@
 END:VCALENDAR
 """,
                 "mailto:user2 at example.com",
-                (False, False, (), None)
+                (True, False, (), """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+DTSTART:20080601T120000Z
+DTEND:20080601T130000Z
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:mailto:user2 at example.com
+ORGANIZER;CN=User 01:mailto:user1 at example.com
+RRULE:COUNT=400;FREQ=DAILY
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:20080602T120000Z
+DTSTART:20080602T123000Z
+DTEND:20080602T130000Z
+ATTENDEE;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:mailto:user2 at example.com
+ORGANIZER:mailto:user1 at example.com
+END:VEVENT
+END:VCALENDAR
+""")
             ),
             (
                 "#1.4 Complex component, additional override no change ok",
@@ -1557,7 +1637,37 @@
 END:VCALENDAR
 """,
                 "mailto:user2 at example.com",
-                (False, False, (), None)
+                (True, False, (), """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+DTSTART:20080601T120000Z
+DTEND:20080601T130000Z
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:mailto:user2 at example.com
+ORGANIZER;CN=User 01:mailto:user1 at example.com
+RRULE:COUNT=400;FREQ=DAILY
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:20080602T120000Z
+DTSTART:20080602T123000Z
+DTEND:20080602T130000Z
+ATTENDEE;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:mailto:user2 at example.com
+ORGANIZER:mailto:user1 at example.com
+END:VEVENT
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:20080604T120000Z
+DTSTART:20080604T120000Z
+DTEND:20080604T130000Z
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:mailto:user2 at example.com
+ORGANIZER;CN=User 01:mailto:user1 at example.com
+END:VEVENT
+END:VCALENDAR
+""")
             ),
         )
 
@@ -2195,7 +2305,20 @@
 END:VCALENDAR
 """,
                 "mailto:user2 at example.com",
-                (False, False, (), None,)
+                (True, False, (), """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:20080604T120000Z
+DTSTART:20080604T130000Z
+DTEND:20080604T140000Z
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:mailto:user2 at example.com
+ORGANIZER;CN=User 01:mailto:user1 at example.com
+END:VEVENT
+END:VCALENDAR
+""",)
             ),
             (
                 "#1.6 Add uncancelled component, no master",
@@ -2237,7 +2360,20 @@
 END:VCALENDAR
 """,
                 "mailto:user2 at example.com",
-                (False, False, (), None,)
+                (True, False, (), """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:20080604T120000Z
+DTSTART:20080604T130000Z
+DTEND:20080604T140000Z
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:mailto:user2 at example.com
+ORGANIZER;CN=User 01:mailto:user1 at example.com
+END:VEVENT
+END:VCALENDAR
+""",)
             ),
         )
 
@@ -2339,7 +2475,19 @@
 END:VCALENDAR
 """,
                 "mailto:user2 at example.com",
-                (False, False, (), None,)
+                (True, False, (), """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+DTSTART:20080601T120000Z
+DTEND:20080601T130000Z
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE;PARTSTAT=ACCEPTED:mailto:user2 at example.com
+ORGANIZER;CN=User 01:mailto:user1 at example.com
+END:VEVENT
+END:VCALENDAR
+""",)
             ),
             (
                 "#1.3 Different dropbox",
@@ -2378,7 +2526,23 @@
 END:VCALENDAR
 """,
                 "mailto:user2 at example.com",
-                (False, False, (), None,)
+                (True, False, (), """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+DTSTART:20080601T120000Z
+DTEND:20080601T130000Z
+ATTACH;VALUE=URI:http://localhost/calendars/users/dropbox/6073432E-644B-49
+ 65-B6F7-C3F08E70BBF9.dropbox/caldavd.plist
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE;PARTSTAT=ACCEPTED:mailto:user2 at example.com
+ORGANIZER;CN=User 01:mailto:user1 at example.com
+X-APPLE-DROPBOX:/calendars/users/dropbox/6073432E-644B-4965-B6F7-C3F08E70B
+ BF9.dropbox
+END:VEVENT
+END:VCALENDAR
+""",)
             ),
             (
                 "#1.4 Change dropbox - remove ATTACH",
@@ -2627,7 +2791,20 @@
 END:VCALENDAR
 """,
                 "mailto:user2 at example.com",
-                (False, False, (), None,)
+                (True, True, ('20080601T120000Z',), """BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//CALENDARSERVER.ORG//NONSGML Version 1//EN
+BEGIN:VEVENT
+UID:12345-67890
+RECURRENCE-ID:20080601T120000Z
+DTSTART:20080601T130000Z
+DTEND:20080601T140000Z
+ATTENDEE:mailto:user1 at example.com
+ATTENDEE;PARTSTAT=ACCEPTED:mailto:user2 at example.com
+ORGANIZER;CN=User 01:mailto:user1 at example.com
+END:VEVENT
+END:VCALENDAR
+""",)
             ),
             (
                 "#2.1 Two overridden components, partstat change - ok",
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20091204/83527c74/attachment-0001.html>


More information about the calendarserver-changes mailing list