Revision
9272
Author
glyph@apple.com
Date
2012-05-24 13:33:28 -0700 (Thu, 24 May 2012)

Log Message

As long as we're always fixing case on the whole mail tokens DB at startup _anyway_, fix case for urn:uuid: as well as mailto:.

Modified Paths

Diff

Modified: CalendarServer/branches/users/glyph/uuid-normalize/twistedcaldav/mail.py (9271 => 9272)


--- CalendarServer/branches/users/glyph/uuid-normalize/twistedcaldav/mail.py	2012-05-24 20:33:25 UTC (rev 9271)
+++ CalendarServer/branches/users/glyph/uuid-normalize/twistedcaldav/mail.py	2012-05-24 20:33:28 UTC (rev 9272)
@@ -744,7 +744,12 @@
         )
         self._db_commit()
 
+
     def lowercase(self):
+        """
+        Lowercase mailto: addresses (and uppercase urn:uuid: addresses!) so
+        they can be located via normalized names.
+        """
         rows = self._db_execute(
             """
             select ORGANIZER, ATTENDEE from TOKENS
@@ -759,6 +764,13 @@
                     update TOKENS set ORGANIZER = :1 WHERE ORGANIZER = :2
                     """, organizer.lower(), organizer
                 )
+            else:
+                from txdav.base.datastore.util import normalizeUUIDOrNot
+                self._db_execute(
+                    """
+                    update TOKENS set ORGANIZER = :1 WHERE ORGANIZER = :2
+                    """, normalizeUUIDOrNot(organizer), organizer
+                )
             self._db_execute(
                 """
                 update TOKENS set ATTENDEE = :1 WHERE ATTENDEE = :2
@@ -766,6 +778,7 @@
             )
         self._db_commit()
 
+
     def _db_version(self):
         """
         @return: the schema version assigned to this index.