[CalendarServer-changes] [8610] CalendarServer/trunk/twistedcaldav/ical.py

source_changes at macosforge.org source_changes at macosforge.org
Tue Jan 31 11:36:23 PST 2012


Revision: 8610
          http://trac.macosforge.org/projects/calendarserver/changeset/8610
Author:   cdaboo at apple.com
Date:     2012-01-31 11:36:23 -0800 (Tue, 31 Jan 2012)
Log Message:
-----------
ACTION:NONE default alarm is not added to iCalendar data on PUT.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/ical.py

Modified: CalendarServer/trunk/twistedcaldav/ical.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/ical.py	2012-01-31 19:34:47 UTC (rev 8609)
+++ CalendarServer/trunk/twistedcaldav/ical.py	2012-01-31 19:36:23 UTC (rev 8610)
@@ -2072,13 +2072,16 @@
                 return True
         return False
 
-    def addAlarms(self, alarm):
+    def addAlarms(self, alarm, ignoreActionNone=True):
         """
         Add an alarm to any VEVENT or VTODO subcomponents that do not already have any.
 
         @param alarm: the text for a VALARM component
         @type alarm: C{str}
         
+        @param ignoreActionNone: whether or not to skip ACTION:NONE alarms
+        @type ignoreActionNone: C{bool}
+        
         @return: indicate whether a change was made
         @rtype: C{bool}
         """
@@ -2109,14 +2112,17 @@
         except IndexError:
             return False
 
+        # ACTION:NONE not added
         changed = False
-        for component in self.subcomponents():
-            if component.name().upper() not in ("VEVENT", "VTODO",):
-                continue
-            if component.hasAlarm():
-                continue
-            component.addComponent(valarm.duplicate())
-            changed = True
+        action = valarm.propertyValue("ACTION")
+        if not ignoreActionNone or action and action.upper() != "NONE":
+            for component in self.subcomponents():
+                if component.name().upper() not in ("VEVENT", "VTODO",):
+                    continue
+                if component.hasAlarm():
+                    continue
+                component.addComponent(valarm.duplicate())
+                changed = True
         
         return changed
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120131/cef022f7/attachment.html>


More information about the calendarserver-changes mailing list