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

source_changes at macosforge.org source_changes at macosforge.org
Thu Dec 11 09:52:18 PST 2008


Revision: 3507
          http://trac.macosforge.org/projects/calendarserver/changeset/3507
Author:   cdaboo at apple.com
Date:     2008-12-11 09:52:18 -0800 (Thu, 11 Dec 2008)
Log Message:
-----------
When removing X- properties, by default also remove X- parameters on all properties except
X- properties we explicitly asked to keep.

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

Modified: CalendarServer/trunk/twistedcaldav/ical.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/ical.py	2008-12-11 17:01:25 UTC (rev 3506)
+++ CalendarServer/trunk/twistedcaldav/ical.py	2008-12-11 17:52:18 UTC (rev 3507)
@@ -1576,20 +1576,25 @@
                 if (keep and p.name() not in keep) or (remove and p.name() in remove):
                     self.removeProperty(p)
                 
-    def removeXProperties(self, keep_properties=(), do_subcomponents=True):
+    def removeXProperties(self, keep_properties=(), remove_x_parameters=True, do_subcomponents=True):
         """
         Remove all X- properties except the specified ones
         """
 
         if do_subcomponents:
             for component in self.subcomponents():
-                component.removeXProperties(keep_properties, do_subcomponents=False)
+                component.removeXProperties(keep_properties, remove_x_parameters, do_subcomponents=False)
         else:
             if self.name() == "VTIMEZONE":
                 return
             for p in tuple(self.properties()):
-                if p.name().startswith("X-") and p.name() not in keep_properties:
+                xpname = p.name().startswith("X-")
+                if xpname and p.name() not in keep_properties:
                     self.removeProperty(p)
+                elif not xpname and remove_x_parameters:
+                    for paramname in tuple(p.params()):
+                        if paramname.startswith("X-"):
+                            del p.params()[paramname]
             
     def removePropertyParameters(self, property, params):
         """
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20081211/4fa8dc43/attachment.html>


More information about the calendarserver-changes mailing list