[CalendarServer-changes] [9324] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Fri Jun 1 12:33:48 PDT 2012
Revision: 9324
http://trac.macosforge.org/projects/calendarserver/changeset/9324
Author: glyph at apple.com
Date: 2012-06-01 12:33:48 -0700 (Fri, 01 Jun 2012)
Log Message:
-----------
Normalize UUIDs when migrating from the file store as well.
Modified Paths:
--------------
CalendarServer/trunk/txdav/caldav/datastore/util.py
CalendarServer/trunk/txdav/common/datastore/upgrade/migrate.py
Property Changed:
----------------
CalendarServer/trunk/
Modified: CalendarServer/trunk/txdav/caldav/datastore/util.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/util.py 2012-06-01 17:45:07 UTC (rev 9323)
+++ CalendarServer/trunk/txdav/caldav/datastore/util.py 2012-06-01 19:33:48 UTC (rev 9324)
@@ -191,8 +191,7 @@
continue
try:
# Must account for metadata
- component = (yield calendarObject.component())
- # ^ FIXME: TESTME: SHOULD CALL 'getComponent' argument
+ component = yield getComponent(calendarObject)
component.md5 = calendarObject.md5()
yield outCalendar.createCalendarObjectWithName(
calendarObject.name(),
Modified: CalendarServer/trunk/txdav/common/datastore/upgrade/migrate.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/upgrade/migrate.py 2012-06-01 17:45:07 UTC (rev 9323)
+++ CalendarServer/trunk/txdav/common/datastore/upgrade/migrate.py 2012-06-01 19:33:48 UTC (rev 9324)
@@ -46,16 +46,39 @@
from txdav.base.propertystore.xattr import PropertyStore as XattrPropertyStore
from txdav.base.propertystore.appledouble_xattr import (PropertyStore
as AppleDoubleStore)
+from txdav.caldav.datastore.util import fixOneCalendarObject
+from txdav.base.datastore.util import normalizeUUIDOrNot
+
+ at inlineCallbacks
+def _getFixedComponent(cobj):
+ """
+ Retrieve a UUID-normalized component from a calendar object (for migrating
+ from the file store).
+
+ @param cobj: a calendar object from the file store.
+ @type cobj: L{ICalendarObject}
+
+ @return: a L{Deferred} which fires with the appropriate L{Component}.
+ """
+ comp = yield cobj.component()
+ fixes, fixed = fixOneCalendarObject(comp)
+ returnValue(fixed)
+
+
+
homeTypeLookup = {
- "calendar": (migrateCalendarHome,
- lambda txn: txn.calendarHomeWithUID),
+ "calendar": (
+ lambda inHome, outHome, getComponent=None, merge=False:
+ migrateCalendarHome(inHome, outHome, _getFixedComponent, merge),
+ lambda txn: txn.calendarHomeWithUID),
"addressbook": (migrateAddressbookHome,
lambda txn: txn.addressbookHomeWithUID)
}
+
def swapAMP(oldAMP, newAMP):
"""
Swap delivery of messages from an old L{AMP} instance to a new one.
@@ -309,7 +332,7 @@
Migrate an individual calendar or addressbook home.
"""
migrateFunc, destFunc = homeTypeLookup.get(homeType)
- uid = fileHome.uid()
+ uid = normalizeUUIDOrNot(fileHome.uid())
self.log_warn("Starting migration transaction %s UID %r" %
(homeType, uid))
sqlTxn = self.sqlStore.newTransaction()
@@ -341,7 +364,6 @@
fileHome._path.remove()
-
@inlineCallbacks
def doMigration(self):
"""
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120601/e683aad4/attachment-0001.html>
More information about the calendarserver-changes
mailing list