[CalendarServer-changes] [8230] CalendarServer/trunk/calendarserver/tools/anonymize.py

source_changes at macosforge.org source_changes at macosforge.org
Thu Oct 27 11:51:30 PDT 2011


Revision: 8230
          http://trac.macosforge.org/projects/calendarserver/changeset/8230
Author:   sagen at apple.com
Date:     2011-10-27 11:51:30 -0700 (Thu, 27 Oct 2011)
Log Message:
-----------
Update anonymizer to use pycalendar

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tools/anonymize.py

Modified: CalendarServer/trunk/calendarserver/tools/anonymize.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/anonymize.py	2011-10-26 20:54:57 UTC (rev 8229)
+++ CalendarServer/trunk/calendarserver/tools/anonymize.py	2011-10-27 18:51:30 UTC (rev 8230)
@@ -34,6 +34,7 @@
 from twext.python.plistlib import readPlistFromString
 
 from pycalendar.calendar import PyCalendar
+from pycalendar.attribute import PyCalendarAttribute
 
 COPY_CAL_XATTRS = (
     'WebDAV:{DAV:}resourcetype',
@@ -301,10 +302,12 @@
                             continue
                     prop.setValue("urn:uuid:%s" % (record['guid'],))
                     if prop.hasAttribute('X-CALENDARSERVER-EMAIL'):
-                        prop.setAttribute('X-CALENDARSERVER-EMAIL', record['email'])
+                        prop.replaceAttribute(PyCalendarAttribute('X-CALENDARSERVER-EMAIL', record['email']))
                     else:
-                        prop.setAttribute('EMAIL', record['email'])
-                    prop.setAttribute('CN', record['name'])
+                        prop.removeAttributes('EMAIL')
+                        prop.addAttribute(PyCalendarAttribute('EMAIL', record['email']))
+                    prop.removeAttributes('CN')
+                    prop.addAttribute(PyCalendarAttribute('CN', record['name']))
             except KeyError:
                 pass
 
@@ -331,7 +334,7 @@
             except KeyError:
                 pass
 
-    return pyobj.serialize()
+    return pyobj.getText(includeTimezones=True)
 
 
 class DirectoryMap(object):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20111027/b15549dc/attachment.html>


More information about the calendarserver-changes mailing list