Modified: CalendarServer/branches/users/glyph/uuid-normalize/txdav/common/datastore/sql.py (9286 => 9287)
--- CalendarServer/branches/users/glyph/uuid-normalize/txdav/common/datastore/sql.py 2012-05-24 20:34:09 UTC (rev 9286)
+++ CalendarServer/branches/users/glyph/uuid-normalize/txdav/common/datastore/sql.py 2012-05-24 20:34:12 UTC (rev 9287)
@@ -4056,8 +4056,8 @@
@param t: the transaction to normalize all the UUIDs in.
@type t: L{CommonStoreTransaction}
- @param homeType: The type of home to scan; ECALENDARTYPE or
- EADDRESSBOOKTYPE.
+ @param homeType: The type of home to scan, L{ECALENDARTYPE},
+ L{EADDRESSBOOKTYPE}, or L{ENOTIFICATIONTYPE}.
@type homeType: C{int}
@return: a L{Deferred} which fires with C{None} when the UUID normalization
@@ -4065,7 +4065,8 @@
"""
from txdav.caldav.datastore.util import fixOneCalendarHome
homeTable = {EADDRESSBOOKTYPE: schema.ADDRESSBOOK_HOME,
- ECALENDARTYPE: schema.CALENDAR_HOME}[homeType]
+ ECALENDARTYPE: schema.CALENDAR_HOME,
+ ENOTIFICATIONTYPE: schema.NOTIFICATION_HOME}[homeType]
allUIDs = yield Select([homeTable.OWNER_UID],
From=homeTable,
@@ -4130,10 +4131,12 @@
@param column: the column to uppercase. Note
@type column: L{ColumnSyntax}
- @return: A L{Deferred} that will fire when the upper-casing of the given
- column has completed.
+ @return: A L{Deferred} that will fire when the UUID normalization of the
+ given column has completed.
"""
tableModel = column.model.table
+ # Get a primary key made of column syntax objects for querying and
+ # comparison later.
pkey = [ColumnSyntax(columnModel)
for columnModel in tableModel.primaryKey]
for row in (yield Select([column] + pkey,
@@ -4143,6 +4146,8 @@
after = normalizeUUIDOrNot(before)
if after != before:
where = _AndNothing
+ # Build a where clause out of the primary key and the parts of the
+ # primary key that were found.
for pkeycol, pkeypart in zip(pkeyparts, pkey):
where = where.And(pkeycol == pkeypart)
yield Update({column: after}, Where=where).on(txn)