[CalendarServer-changes] [13798] CalendarServer/trunk/twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Sun Jul 27 10:05:00 PDT 2014
Revision: 13798
http://trac.calendarserver.org//changeset/13798
Author: sagen at apple.com
Date: 2014-07-27 10:05:00 -0700 (Sun, 27 Jul 2014)
Log Message:
-----------
Normalize the UUID values in resources.xml during upgrade
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/test/test_upgrade.py
CalendarServer/trunk/twistedcaldav/upgrade.py
Modified: CalendarServer/trunk/twistedcaldav/test/test_upgrade.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_upgrade.py 2014-07-26 18:53:56 UTC (rev 13797)
+++ CalendarServer/trunk/twistedcaldav/test/test_upgrade.py 2014-07-27 17:05:00 UTC (rev 13798)
@@ -1520,6 +1520,11 @@
<guid>C4F46062-9094-4D34-8591-61A42D993FAA</guid>
<name>location name</name>
</location>
+ <location>
+ <uid>5456580a-08ee-4288-8a87-2b4204a62a12</uid>
+ <guid>5456580a-08ee-4288-8a87-2b4204a62a12</guid>
+ <name>Fake Room</name>
+ </location>
<resource>
<uid>resource1</uid>
<guid>60B771CC-D727-4453-ACE0-0FE13CD7445A</guid>
@@ -1528,7 +1533,7 @@
</accounts>
"""
-newResourcesFormat = """<directory realm="/Search"><record type="location"><short-name>location1</short-name><guid>C4F46062-9094-4D34-8591-61A42D993FAA</guid><uid>C4F46062-9094-4D34-8591-61A42D993FAA</uid><full-name>location name</full-name></record><record type="resource"><short-name>resource1</short-name><guid>60B771CC-D727-4453-ACE0-0FE13CD7445A</guid><uid>60B771CC-D727-4453-ACE0-0FE13CD7445A</uid><full-name>resource name</full-name></record></directory>"""
+newResourcesFormat = """<directory realm="/Search"><record type="location"><short-name>location1</short-name><guid>C4F46062-9094-4D34-8591-61A42D993FAA</guid><uid>C4F46062-9094-4D34-8591-61A42D993FAA</uid><full-name>location name</full-name></record><record type="location"><short-name>5456580A-08EE-4288-8A87-2B4204A62A12</short-name><guid>5456580A-08EE-4288-8A87-2B4204A62A12</guid><uid>5456580A-08EE-4288-8A87-2B4204A62A12</uid><full-name>Fake Room</full-name></record><record type="resource"><short-name>resource1</short-name><guid>60B771CC-D727-4453-ACE0-0FE13CD7445A</guid><uid>60B771CC-D727-4453-ACE0-0FE13CD7445A</uid><full-name>resource name</full-name></record></directory>"""
normalizeEvent = """BEGIN:VCALENDAR
Modified: CalendarServer/trunk/twistedcaldav/upgrade.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/upgrade.py 2014-07-26 18:53:56 UTC (rev 13797)
+++ CalendarServer/trunk/twistedcaldav/upgrade.py 2014-07-27 17:05:00 UTC (rev 13798)
@@ -27,6 +27,7 @@
import shutil
import errno
import time
+import uuid
from zlib import compress
from cPickle import loads as unpickle, UnpicklingError
@@ -691,7 +692,13 @@
if tags:
for tag in tags:
destFieldNode = XMLElement(tag)
- destFieldNode.text = sourceFieldNode.text
+ value = sourceFieldNode.text
+ try:
+ # Normalize UUID values to uppercase
+ value = str(uuid.UUID(value)).upper()
+ except ValueError:
+ pass
+ destFieldNode.text = value
destNode.append(destFieldNode)
directoryNode.append(destNode)
@@ -925,7 +932,7 @@
)
from twext.who.util import ConstantsContainer
from calendarserver.tools.resources import migrateResources
- from txdav.who.opendirectory import _CSRecordType # Use this module for the import to make sure constants are setup properly
+ from txdav.who.opendirectory import _CSRecordType # Use this module for the import to make sure constants are setup properly
# We need to "patch" twext.who.opendirectory._service.DirectoryService to include resources and locations as supported record types
# during migration
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140727/0b08a27b/attachment.html>
More information about the calendarserver-changes
mailing list