[CalendarServer-changes] [4875] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Thu Dec 17 10:40:44 PST 2009


Revision: 4875
          http://trac.macosforge.org/projects/calendarserver/changeset/4875
Author:   cdaboo at apple.com
Date:     2009-12-17 10:40:43 -0800 (Thu, 17 Dec 2009)
Log Message:
-----------
Fix implicit scheduling of VTODOs.

Modified Paths:
--------------
    CalendarServer/trunk/support/build.sh
    CalendarServer/trunk/twistedcaldav/dateops.py
    CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py
    CalendarServer/trunk/twistedcaldav/scheduling/itip.py

Modified: CalendarServer/trunk/support/build.sh
===================================================================
--- CalendarServer/trunk/support/build.sh	2009-12-17 18:37:40 UTC (rev 4874)
+++ CalendarServer/trunk/support/build.sh	2009-12-17 18:40:43 UTC (rev 4875)
@@ -496,7 +496,7 @@
     false true true true 212;
 
   # Tool dependencies.  The code itself doesn't depend on these, but you probably want them.
-  svn_get "CalDAVTester" "${top}/CalDAVTester" "${svn_uri_base}/CalDAVTester/trunk" 4853;
+  svn_get "CalDAVTester" "${top}/CalDAVTester" "${svn_uri_base}/CalDAVTester/trunk" 4874;
   svn_get "Pyflakes" "${top}/Pyflakes" http://divmod.org/svn/Divmod/trunk/Pyflakes 17198;
 }
 

Modified: CalendarServer/trunk/twistedcaldav/dateops.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/dateops.py	2009-12-17 18:37:40 UTC (rev 4874)
+++ CalendarServer/trunk/twistedcaldav/dateops.py	2009-12-17 18:40:43 UTC (rev 4875)
@@ -52,8 +52,9 @@
     DTSTART and DTEND.
     """
     
-    assert dtend is None or duration is None, "Cannot specify both dtend and duration" 
-    dtstart = normalizeToUTC(dtstart)
+    assert dtend is None or duration is None, "Cannot specify both dtend and duration"
+    if dtstart is not None:
+        dtstart = normalizeToUTC(dtstart)
     if dtend is not None:
         dtend = normalizeToUTC(dtend)
     elif duration:

Modified: CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py	2009-12-17 18:37:40 UTC (rev 4874)
+++ CalendarServer/trunk/twistedcaldav/scheduling/icaldiff.py	2009-12-17 18:40:43 UTC (rev 4875)
@@ -530,7 +530,7 @@
         # Need to special case EXDATEs as an Attendee can effectively DECLINE by adding an EXDATE
         if serverProps[:-1] != clientProps[:-1]:
             invalidChanges = []
-            propNames = ("DTSTART", "DTEND", "RRULE", "RDATE", "EXDATE")
+            propNames = ("DTSTART", "DTEND", "DUE", "RRULE", "RDATE", "EXDATE")
             invalidChanges = [propName for ctr, propName in enumerate(propNames) if serverProps[ctr] != clientProps[ctr]]
             log.debug("Critical properties do not match: %s" % (", ".join(invalidChanges),))
             return False
@@ -548,16 +548,35 @@
     def _getNormalizedDateTimeProperties(self, component):
         
         # Basic time properties
-        dtstart = component.getProperty("DTSTART")
-        dtend = component.getProperty("DTEND")
-        duration = component.getProperty("DURATION")
-        
-        newdtstart, newdtend = normalizeStartEndDuration(
-            dtstart.value(),
-            dtend.value() if dtend is not None else None,
-            duration.value() if duration is not None else None,
-        )
-        
+        if component.name() in ("VEVENT", "VJOURNAL",):
+            dtstart = component.getProperty("DTSTART")
+            dtend = component.getProperty("DTEND")
+            duration = component.getProperty("DURATION")
+            
+            newdtstart, newdtend = normalizeStartEndDuration(
+                dtstart.value() if dtstart is not None else None,
+                dtend.value() if dtend is not None else None,
+                duration.value() if duration is not None else None,
+            )
+            newdue = None
+            
+        elif component.name() == "VTODO":
+            dtstart = component.getProperty("DTSTART")
+            duration = component.getProperty("DURATION")
+            
+            if dtstart or duration:
+                newdtstart, newdtend = normalizeStartEndDuration(
+                    dtstart.value() if dtstart is not None else None,
+                    None,
+                    duration.value() if duration is not None else None,
+                )
+            else:
+                newdtstart = newdtend = None
+
+            newdue = component.getProperty("DUE")
+            if newdue is not None:
+                newdue = normalizeToUTC(newdue.value())
+            
         # Recurrence rules - we need to normalize the order of the value parts
         newrrules = set()
         rrules = component.properties("RRULE")
@@ -579,7 +598,7 @@
         for exdate in exdates:
             newexdates.update([normalizeToUTC(value) for value in exdate.value()])
 
-        return newdtstart, newdtend, newrrules, newrdates, newexdates
+        return newdtstart, newdtend, newdue, newrrules, newrdates, newexdates
 
     def _transferProperty(self, propName, serverComponent, clientComponent):
 

Modified: CalendarServer/trunk/twistedcaldav/scheduling/itip.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/itip.py	2009-12-17 18:37:40 UTC (rev 4874)
+++ CalendarServer/trunk/twistedcaldav/scheduling/itip.py	2009-12-17 18:40:43 UTC (rev 4875)
@@ -491,7 +491,7 @@
     def fixForiCal3(components, recipient, compatibilityMode):
         # For each component where the ATTENDEE property of the recipient has PARTSTAT
         # NEEDS-ACTION we need to add X-APPLE-NEEDS-REPLY:TRUE
-        # We also add TRANSP:TRANSPARENT
+        # We also add TRANSP:TRANSPARENT for VEVENTs
         for component in components:
             if component.name() == "VTIMEZONE":
                 continue
@@ -501,7 +501,8 @@
                 if partstat == "NEEDS-ACTION":
                     if compatibilityMode:
                         component.addProperty(Property("X-APPLE-NEEDS-REPLY", "TRUE"))
-                    component.replaceProperty(Property("TRANSP", "TRANSPARENT"))
+                    if component.name() == "VEVENT":
+                        component.replaceProperty(Property("TRANSP", "TRANSPARENT"))
 
 class iTipGenerator(object):
     
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20091217/1aa38c94/attachment.html>


More information about the calendarserver-changes mailing list