[CalendarServer-changes] [12867] CalendarServer/branches/users/sagen/move2who-2/txdav

source_changes at macosforge.org source_changes at macosforge.org
Mon Mar 10 13:06:09 PDT 2014


Revision: 12867
          http://trac.calendarserver.org//changeset/12867
Author:   sagen at apple.com
Date:     2014-03-10 13:06:08 -0700 (Mon, 10 Mar 2014)
Log Message:
-----------
Get more tests to pass

Modified Paths:
--------------
    CalendarServer/branches/users/sagen/move2who-2/txdav/caldav/datastore/scheduling/freebusy.py
    CalendarServer/branches/users/sagen/move2who-2/txdav/caldav/datastore/scheduling/implicit.py
    CalendarServer/branches/users/sagen/move2who-2/txdav/caldav/datastore/scheduling/work.py
    CalendarServer/branches/users/sagen/move2who-2/txdav/caldav/datastore/sql.py
    CalendarServer/branches/users/sagen/move2who-2/txdav/caldav/datastore/test/attachments/accounts.xml
    CalendarServer/branches/users/sagen/move2who-2/txdav/caldav/datastore/test/test_attachments.py
    CalendarServer/branches/users/sagen/move2who-2/txdav/common/datastore/file.py
    CalendarServer/branches/users/sagen/move2who-2/txdav/common/datastore/podding/conduit.py
    CalendarServer/branches/users/sagen/move2who-2/txdav/common/datastore/sql.py
    CalendarServer/branches/users/sagen/move2who-2/txdav/dps/test/test_client.py
    CalendarServer/branches/users/sagen/move2who-2/txdav/who/augment.py

Modified: CalendarServer/branches/users/sagen/move2who-2/txdav/caldav/datastore/scheduling/freebusy.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-2/txdav/caldav/datastore/scheduling/freebusy.py	2014-03-10 18:20:46 UTC (rev 12866)
+++ CalendarServer/branches/users/sagen/move2who-2/txdav/caldav/datastore/scheduling/freebusy.py	2014-03-10 20:06:08 UTC (rev 12867)
@@ -47,6 +47,8 @@
 
 fbcacher = Memcacher("FBCache", pickle=True)
 
+
+
 class FBCacheEntry(object):
 
     CACHE_DAYS_FLOATING_ADJUST = 1
@@ -217,7 +219,7 @@
 
     # Free busy is per-user
     attendee_uid = calresource.viewerHome().uid()
-    attendee_record = yield calresource.directoryService().recordWithUID(attendee_uid)
+    attendee_record = yield calresource.directoryService().recordWithUID(attendee_uid.decode("utf-8"))
 
     # Get the timezone property from the collection.
     tz = calresource.getTimezone()
@@ -237,7 +239,7 @@
         authz_record = organizer_record
         if hasattr(calresource._txn, "_authz_uid") and calresource._txn._authz_uid != organizer_uid:
             authz_uid = calresource._txn._authz_uid
-            authz_record = yield calresource.directoryService().recordWithUID(unicode(authz_uid))
+            authz_record = yield calresource.directoryService().recordWithUID(authz_uid.decode("utf-8"))
 
         # Check if attendee is also the organizer or the delegate doing the request
         if attendee_uid in (organizer_uid, authz_uid):

Modified: CalendarServer/branches/users/sagen/move2who-2/txdav/caldav/datastore/scheduling/implicit.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-2/txdav/caldav/datastore/scheduling/implicit.py	2014-03-10 18:20:46 UTC (rev 12866)
+++ CalendarServer/branches/users/sagen/move2who-2/txdav/caldav/datastore/scheduling/implicit.py	2014-03-10 20:06:08 UTC (rev 12867)
@@ -479,7 +479,7 @@
         # Get some useful information from the calendar
         yield self.extractCalendarData()
 
-        self.attendeePrincipal = yield self.calendar_home.directoryService().recordWithUID(self.calendar_home.uid())
+        self.attendeePrincipal = yield self.calendar_home.directoryService().recordWithUID(self.calendar_home.uid().decode("utf-8"))
         self.originator = self.attendee = self.attendeePrincipal.canonicalCalendarUserAddress()
 
         result = (yield self.scheduleWithOrganizer())
@@ -491,7 +491,7 @@
     def extractCalendarData(self):
 
         # Get the originator who is the owner of the calendar resource being modified
-        self.originatorPrincipal = yield self.calendar_home.directoryService().recordWithUID(self.calendar_home.uid())
+        self.originatorPrincipal = yield self.calendar_home.directoryService().recordWithUID(self.calendar_home.uid().decode("utf-8"))
 
         # Pick the canonical CUA:
         self.originator = self.originatorPrincipal.canonicalCalendarUserAddress()

Modified: CalendarServer/branches/users/sagen/move2who-2/txdav/caldav/datastore/scheduling/work.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-2/txdav/caldav/datastore/scheduling/work.py	2014-03-10 18:20:46 UTC (rev 12866)
+++ CalendarServer/branches/users/sagen/move2who-2/txdav/caldav/datastore/scheduling/work.py	2014-03-10 20:06:08 UTC (rev 12867)
@@ -45,6 +45,8 @@
 
 log = Logger()
 
+
+
 class ScheduleWorkMixin(object):
     """
     Base class for common schedule work item behavior.
@@ -189,7 +191,7 @@
         try:
             home = (yield self.transaction.calendarHomeWithResourceID(self.homeResourceID))
             resource = (yield home.objectResourceWithID(self.resourceID))
-            organizerPrincipal = yield home.directoryService().recordWithUID(home.uid())
+            organizerPrincipal = yield home.directoryService().recordWithUID(home.uid().decode("utf-8"))
             organizer = organizerPrincipal.canonicalCalendarUserAddress()
             calendar_old = Component.fromString(self.icalendarTextOld) if self.icalendarTextOld else None
             calendar_new = Component.fromString(self.icalendarTextNew) if self.icalendarTextNew else None
@@ -311,7 +313,7 @@
         try:
             home = (yield self.transaction.calendarHomeWithResourceID(self.homeResourceID))
             resource = (yield home.objectResourceWithID(self.resourceID))
-            attendeePrincipal = yield home.directoryService().recordWithUID(home.uid())
+            attendeePrincipal = yield home.directoryService().recordWithUID(home.uid().decode("utf-8"))
             attendee = attendeePrincipal.canonicalCalendarUserAddress()
             calendar = (yield resource.componentForUser())
             organizer = calendar.validOrganizerForScheduling()
@@ -382,7 +384,7 @@
 
         try:
             home = (yield self.transaction.calendarHomeWithResourceID(self.homeResourceID))
-            attendeePrincipal = yield home.directoryService().recordWithUID(home.uid())
+            attendeePrincipal = yield home.directoryService().recordWithUID(home.uid().decode("utf-8"))
             attendee = attendeePrincipal.canonicalCalendarUserAddress()
             calendar = Component.fromString(self.icalendarText)
             organizer = calendar.validOrganizerForScheduling()

Modified: CalendarServer/branches/users/sagen/move2who-2/txdav/caldav/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-2/txdav/caldav/datastore/sql.py	2014-03-10 18:20:46 UTC (rev 12866)
+++ CalendarServer/branches/users/sagen/move2who-2/txdav/caldav/datastore/sql.py	2014-03-10 20:06:08 UTC (rev 12867)
@@ -2010,7 +2010,7 @@
 
                 # Find current principal and update modified by details
                 if hasattr(self._txn, "_authz_uid"):
-                    authz = yield self.directoryService().recordWithUID(self._txn._authz_uid)
+                    authz = yield self.directoryService().recordWithUID(self._txn._authz_uid.decode("utf-8"))
                     prop = Property("X-CALENDARSERVER-MODIFIED-BY", authz.canonicalCalendarUserAddress())
                     prop.setParameter("CN", authz.displayName())
                     for candidate in authz.calendarUserAddresses():

Modified: CalendarServer/branches/users/sagen/move2who-2/txdav/caldav/datastore/test/attachments/accounts.xml
===================================================================
--- CalendarServer/branches/users/sagen/move2who-2/txdav/caldav/datastore/test/attachments/accounts.xml	2014-03-10 18:20:46 UTC (rev 12866)
+++ CalendarServer/branches/users/sagen/move2who-2/txdav/caldav/datastore/test/attachments/accounts.xml	2014-03-10 20:06:08 UTC (rev 12867)
@@ -18,19 +18,19 @@
 
 <!DOCTYPE accounts SYSTEM "../../../conf/auth/accounts.dtd">
 
-<accounts realm="/Search">
-  <user>
+<directory realm="/Search">
+  <record type="user">
     <uid>home1</uid>
-    <guid>home1</guid>
+    <short-name>home1</short-name>
     <password>home1</password>
-    <name>Example User 1</name>
-    <email-address>home1 at example.com</email-address>
-  </user>
-  <user>
+    <full-name>Example User 1</full-name>
+    <email>home1 at example.com</email>
+  </record>
+  <record type="user">
     <uid>home2</uid>
-    <guid>home2</guid>
+    <short-name>home2</short-name>
     <password>home2</password>
-    <name>Example User 2</name>
-    <email-address>home2 at example.com</email-address>
-  </user>
-</accounts>
+    <full-name>Example User 2</full-name>
+    <email>home2 at example.com</email>
+  </record>
+</directory>

Modified: CalendarServer/branches/users/sagen/move2who-2/txdav/caldav/datastore/test/test_attachments.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-2/txdav/caldav/datastore/test/test_attachments.py	2014-03-10 18:20:46 UTC (rev 12866)
+++ CalendarServer/branches/users/sagen/move2who-2/txdav/caldav/datastore/test/test_attachments.py	2014-03-10 20:06:08 UTC (rev 12867)
@@ -49,7 +49,7 @@
 """
 
 storePath = FilePath(__file__).parent().child("calendar_store")
-homeRoot = storePath.child("ho").child("me").child("home1")
+homeRoot = storePath.child("ho").child("me").child(u"home1")
 cal1Root = homeRoot.child("calendar_1")
 
 calendar1_objectNames = [
@@ -597,7 +597,7 @@
 
         self.assertTrue(os.path.exists(apath))
 
-        home = (yield self.transactionUnderTest().calendarHomeWithUID("home1"))
+        home = (yield self.transactionUnderTest().calendarHomeWithUID(u"home1"))
         quota = (yield home.quotaUsedBytes())
         yield self.commit()
         self.assertNotEqual(quota, 0)
@@ -609,7 +609,7 @@
 
         self.assertFalse(os.path.exists(apath))
 
-        home = (yield self.transactionUnderTest().calendarHomeWithUID("home1"))
+        home = (yield self.transactionUnderTest().calendarHomeWithUID(u"home1"))
         quota = (yield home.quotaUsedBytes())
         yield self.commit()
         self.assertEqual(quota, 0)
@@ -648,7 +648,7 @@
         self.assertTrue(os.path.exists(apath1))
         self.assertTrue(os.path.exists(apath2))
 
-        home = (yield self.transactionUnderTest().calendarHomeWithUID("home1"))
+        home = (yield self.transactionUnderTest().calendarHomeWithUID(u"home1"))
         quota = (yield home.quotaUsedBytes())
         yield self.commit()
         self.assertNotEqual(quota, 0)
@@ -661,7 +661,7 @@
         self.assertFalse(os.path.exists(apath1))
         self.assertFalse(os.path.exists(apath2))
 
-        home = (yield self.transactionUnderTest().calendarHomeWithUID("home1"))
+        home = (yield self.transactionUnderTest().calendarHomeWithUID(u"home1"))
         quota = (yield home.quotaUsedBytes())
         yield self.commit()
         self.assertEqual(quota, 0)
@@ -743,7 +743,7 @@
 
         self.assertTrue(os.path.exists(apath))
 
-        home = (yield self.transactionUnderTest().calendarHomeWithUID("home1"))
+        home = (yield self.transactionUnderTest().calendarHomeWithUID(u"home1"))
         quota = (yield home.quotaUsedBytes())
         yield self.commit()
         self.assertNotEqual(quota, 0)
@@ -755,7 +755,7 @@
 
         self.assertTrue(os.path.exists(apath))
 
-        home = (yield self.transactionUnderTest().calendarHomeWithUID("home1"))
+        home = (yield self.transactionUnderTest().calendarHomeWithUID(u"home1"))
         quota = (yield home.quotaUsedBytes())
         yield self.commit()
         self.assertNotEqual(quota, 0)
@@ -767,7 +767,7 @@
 
         self.assertFalse(os.path.exists(apath))
 
-        home = (yield self.transactionUnderTest().calendarHomeWithUID("home1"))
+        home = (yield self.transactionUnderTest().calendarHomeWithUID(u"home1"))
         quota = (yield home.quotaUsedBytes())
         yield self.commit()
         self.assertEqual(quota, 0)
@@ -1131,7 +1131,7 @@
 
         self.assertTrue(os.path.exists(apath))
 
-        home = (yield self.transactionUnderTest().calendarHomeWithUID("home1"))
+        home = (yield self.transactionUnderTest().calendarHomeWithUID(u"home1"))
         quota = (yield home.quotaUsedBytes())
         yield self.commit()
         self.assertNotEqual(quota, 0)
@@ -1143,7 +1143,7 @@
 
         self.assertFalse(os.path.exists(apath))
 
-        home = (yield self.transactionUnderTest().calendarHomeWithUID("home1"))
+        home = (yield self.transactionUnderTest().calendarHomeWithUID(u"home1"))
         quota = (yield home.quotaUsedBytes())
         yield self.commit()
         self.assertEqual(quota, 0)
@@ -1178,7 +1178,7 @@
         self.assertTrue(os.path.exists(apath1))
         self.assertTrue(os.path.exists(apath2))
 
-        home = (yield self.transactionUnderTest().calendarHomeWithUID("home1"))
+        home = (yield self.transactionUnderTest().calendarHomeWithUID(u"home1"))
         quota = (yield home.quotaUsedBytes())
         yield self.commit()
         self.assertNotEqual(quota, 0)
@@ -1191,7 +1191,7 @@
         self.assertFalse(os.path.exists(apath1))
         self.assertFalse(os.path.exists(apath2))
 
-        home = (yield self.transactionUnderTest().calendarHomeWithUID("home1"))
+        home = (yield self.transactionUnderTest().calendarHomeWithUID(u"home1"))
         quota = (yield home.quotaUsedBytes())
         yield self.commit()
         self.assertEqual(quota, 0)
@@ -1218,7 +1218,7 @@
 
         self.assertTrue(os.path.exists(apath))
 
-        home = (yield self.transactionUnderTest().calendarHomeWithUID("home1"))
+        home = (yield self.transactionUnderTest().calendarHomeWithUID(u"home1"))
         quota = (yield home.quotaUsedBytes())
         yield self.commit()
         self.assertNotEqual(quota, 0)
@@ -1230,7 +1230,7 @@
 
         self.assertTrue(os.path.exists(apath))
 
-        home = (yield self.transactionUnderTest().calendarHomeWithUID("home1"))
+        home = (yield self.transactionUnderTest().calendarHomeWithUID(u"home1"))
         quota = (yield home.quotaUsedBytes())
         yield self.commit()
         self.assertNotEqual(quota, 0)
@@ -1242,7 +1242,7 @@
 
         self.assertFalse(os.path.exists(apath))
 
-        home = (yield self.transactionUnderTest().calendarHomeWithUID("home1"))
+        home = (yield self.transactionUnderTest().calendarHomeWithUID(u"home1"))
         quota = (yield home.quotaUsedBytes())
         yield self.commit()
         self.assertEqual(quota, 0)
@@ -1363,7 +1363,7 @@
     }
 
     requirements = {
-        "home1" : {
+        u"home1" : {
             "calendar1" : {
                 "1.1.ics" : (PLAIN_ICS % {"year": now, "uid": "1.1", }, metadata,),
                 "1.2.ics" : (ATTACHMENT_ICS % {"year": now, "uid": "1.2", "userid": "user01", "dropboxid": "1.2"}, metadata,),
@@ -1372,7 +1372,7 @@
                 "1.5.ics" : (ATTACHMENT_ICS % {"year": now, "uid": "1.5", "userid": "user01", "dropboxid": "1.4"}, metadata,),
             }
         },
-        "home2" : {
+        u"home2" : {
             "calendar2" : {
                 "2-2.1.ics" : (PLAIN_ICS % {"year": now, "uid": "2-2.1", }, metadata,),
                 "2-2.2.ics" : (ATTACHMENT_ICS % {"year": now, "uid": "2-2.2", "userid": "user02", "dropboxid": "2.2"}, metadata,),
@@ -1488,16 +1488,16 @@
         """
         Add the full set of attachments to be used for testing.
         """
-        yield self._addAttachment("home1", "calendar1", "1.2.ics", "1.2", "attach_1_2_1.txt")
-        yield self._addAttachment("home1", "calendar1", "1.2.ics", "1.2", "attach_1_2_2.txt")
-        yield self._addAttachment("home1", "calendar1", "1.3.ics", "1.3", "attach_1_3.txt")
-        yield self._addAttachment("home1", "calendar1", "1.4.ics", "1.4", "attach_1_4.txt")
-        yield self._addAttachmentProperty("home1", "calendar1", "1.5.ics", "1.4", "home1", "attach_1_4.txt")
+        yield self._addAttachment(u"home1", "calendar1", "1.2.ics", "1.2", "attach_1_2_1.txt")
+        yield self._addAttachment(u"home1", "calendar1", "1.2.ics", "1.2", "attach_1_2_2.txt")
+        yield self._addAttachment(u"home1", "calendar1", "1.3.ics", "1.3", "attach_1_3.txt")
+        yield self._addAttachment(u"home1", "calendar1", "1.4.ics", "1.4", "attach_1_4.txt")
+        yield self._addAttachmentProperty(u"home1", "calendar1", "1.5.ics", "1.4", "home1", "attach_1_4.txt")
 
-        yield self._addAttachment("home2", "calendar2", "2-2.2.ics", "2.2", "attach_2_2.txt")
-        yield self._addAttachmentProperty("home2", "calendar2", "2-2.3.ics", "1.3", "home1", "attach_1_3.txt")
-        yield self._addAttachmentProperty("home2", "calendar3", "2-3.2.ics", "1.4", "home1", "attach_1_4.txt")
-        yield self._addAttachmentProperty("home2", "calendar3", "2-3.3.ics", "1.4", "home1", "attach_1_4.txt")
+        yield self._addAttachment(u"home2", "calendar2", "2-2.2.ics", "2.2", "attach_2_2.txt")
+        yield self._addAttachmentProperty(u"home2", "calendar2", "2-2.3.ics", "1.3", "home1", "attach_1_3.txt")
+        yield self._addAttachmentProperty(u"home2", "calendar3", "2-3.2.ics", "1.4", "home1", "attach_1_4.txt")
+        yield self._addAttachmentProperty(u"home2", "calendar3", "2-3.3.ics", "1.4", "home1", "attach_1_4.txt")
 
 
     @inlineCallbacks
@@ -1586,7 +1586,7 @@
         """
         Test L{txdav.caldav.datastore.sql.DropboxAttachment.convertToManaged} converts properly to a ManagedAttachment.
         """
-        yield self._addAttachment("home1", "calendar1", "1.2.ics", "1.2", "attach_1_2.txt")
+        yield self._addAttachment(u"home1", "calendar1", "1.2.ics", "1.2", "attach_1_2.txt")
 
         txn = self._sqlCalendarStore.newTransaction()
 
@@ -1616,11 +1616,11 @@
         """
         Test L{txdav.caldav.datastore.sql.ManagedAttachment.newReference} creates a new managed attachment reference.
         """
-        yield self._addAttachment("home1", "calendar1", "1.4.ics", "1.4", "attach_1_4.txt")
+        yield self._addAttachment(u"home1", "calendar1", "1.4.ics", "1.4", "attach_1_4.txt")
 
         txn = self._sqlCalendarStore.newTransaction()
 
-        home = (yield txn.calendarHomeWithUID("home1"))
+        home = (yield txn.calendarHomeWithUID(u"home1"))
         calendar = (yield home.calendarWithName("calendar1"))
         event4 = (yield calendar.calendarObjectWithName("1.4.ics"))
         event5 = (yield calendar.calendarObjectWithName("1.5.ics"))
@@ -1664,12 +1664,12 @@
         """
         Test L{txdav.caldav.datastore.sql.CalendarObject.convertAttachments} re-writes calendar data.
         """
-        yield self._addAttachment("home1", "calendar1", "1.2.ics", "1.2", "attach_1_2_1.txt")
-        yield self._addAttachment("home1", "calendar1", "1.2.ics", "1.2", "attach_1_2_2.txt")
+        yield self._addAttachment(u"home1", "calendar1", "1.2.ics", "1.2", "attach_1_2_1.txt")
+        yield self._addAttachment(u"home1", "calendar1", "1.2.ics", "1.2", "attach_1_2_2.txt")
 
         txn = self._sqlCalendarStore.newTransaction()
 
-        home = (yield txn.calendarHomeWithUID("home1"))
+        home = (yield txn.calendarHomeWithUID(u"home1"))
         calendar = (yield home.calendarWithName("calendar1"))
         event = (yield calendar.calendarObjectWithName("1.2.ics"))
 
@@ -1688,7 +1688,7 @@
 
         txn = self._sqlCalendarStore.newTransaction()
 
-        home = (yield txn.calendarHomeWithUID("home1"))
+        home = (yield txn.calendarHomeWithUID(u"home1"))
         calendar = (yield home.calendarWithName("calendar1"))
         event = (yield calendar.calendarObjectWithName("1.2.ics"))
 
@@ -1712,7 +1712,7 @@
 
         # Convert the second dropbox attachment
         txn = self._sqlCalendarStore.newTransaction()
-        home = (yield txn.calendarHomeWithUID("home1"))
+        home = (yield txn.calendarHomeWithUID(u"home1"))
         calendar = (yield home.calendarWithName("calendar1"))
         event = (yield calendar.calendarObjectWithName("1.2.ics"))
         dattachment = (yield DropBoxAttachment.load(txn, "1.2.dropbox", "attach_1_2_2.txt"))
@@ -1722,7 +1722,7 @@
         yield txn.commit()
 
         txn = self._sqlCalendarStore.newTransaction()
-        home = (yield txn.calendarHomeWithUID("home1"))
+        home = (yield txn.calendarHomeWithUID(u"home1"))
         calendar = (yield home.calendarWithName("calendar1"))
         event = (yield calendar.calendarObjectWithName("1.2.ics"))
         component = (yield event.componentForUser()).mainComponent()
@@ -1760,14 +1760,14 @@
         yield calstore._upgradeDropbox(txn, "1.2.dropbox")
         yield txn.commit()
 
-        yield self._verifyConversion("home1", "calendar1", "1.2.ics", ("attach_1_2_1.txt", "attach_1_2_2.txt",))
-        yield self._verifyNoConversion("home1", "calendar1", "1.3.ics", ("attach_1_3.txt",))
-        yield self._verifyNoConversion("home1", "calendar1", "1.4.ics", ("attach_1_4.txt",))
-        yield self._verifyNoConversion("home1", "calendar1", "1.5.ics", ("attach_1_4.txt",))
-        yield self._verifyNoConversion("home2", "calendar2", "2-2.2.ics", ("attach_2_2.txt",))
-        yield self._verifyNoConversion("home2", "calendar2", "2-2.3.ics", ("attach_1_3.txt",))
-        yield self._verifyNoConversion("home2", "calendar3", "2-3.2.ics", ("attach_1_4.txt",))
-        yield self._verifyNoConversion("home2", "calendar3", "2-3.3.ics", ("attach_1_4.txt",))
+        yield self._verifyConversion(u"home1", "calendar1", "1.2.ics", ("attach_1_2_1.txt", "attach_1_2_2.txt",))
+        yield self._verifyNoConversion(u"home1", "calendar1", "1.3.ics", ("attach_1_3.txt",))
+        yield self._verifyNoConversion(u"home1", "calendar1", "1.4.ics", ("attach_1_4.txt",))
+        yield self._verifyNoConversion(u"home1", "calendar1", "1.5.ics", ("attach_1_4.txt",))
+        yield self._verifyNoConversion(u"home2", "calendar2", "2-2.2.ics", ("attach_2_2.txt",))
+        yield self._verifyNoConversion(u"home2", "calendar2", "2-2.3.ics", ("attach_1_3.txt",))
+        yield self._verifyNoConversion(u"home2", "calendar3", "2-3.2.ics", ("attach_1_4.txt",))
+        yield self._verifyNoConversion(u"home2", "calendar3", "2-3.3.ics", ("attach_1_4.txt",))
 
 
     @inlineCallbacks
@@ -1784,14 +1784,14 @@
         yield calstore._upgradeDropbox(txn, "1.3.dropbox")
         yield txn.commit()
 
-        yield self._verifyNoConversion("home1", "calendar1", "1.2.ics", ("attach_1_2_1.txt", "attach_1_2_2.txt",))
-        yield self._verifyConversion("home1", "calendar1", "1.3.ics", ("attach_1_3.txt",))
-        yield self._verifyNoConversion("home1", "calendar1", "1.4.ics", ("attach_1_4.txt",))
-        yield self._verifyNoConversion("home1", "calendar1", "1.5.ics", ("attach_1_4.txt",))
-        yield self._verifyNoConversion("home2", "calendar2", "2-2.2.ics", ("attach_2_2.txt",))
-        yield self._verifyConversion("home2", "calendar2", "2-2.3.ics", ("attach_1_3.txt",))
-        yield self._verifyNoConversion("home2", "calendar3", "2-3.2.ics", ("attach_1_4.txt",))
-        yield self._verifyNoConversion("home2", "calendar3", "2-3.3.ics", ("attach_1_4.txt",))
+        yield self._verifyNoConversion(u"home1", "calendar1", "1.2.ics", ("attach_1_2_1.txt", "attach_1_2_2.txt",))
+        yield self._verifyConversion(u"home1", "calendar1", "1.3.ics", ("attach_1_3.txt",))
+        yield self._verifyNoConversion(u"home1", "calendar1", "1.4.ics", ("attach_1_4.txt",))
+        yield self._verifyNoConversion(u"home1", "calendar1", "1.5.ics", ("attach_1_4.txt",))
+        yield self._verifyNoConversion(u"home2", "calendar2", "2-2.2.ics", ("attach_2_2.txt",))
+        yield self._verifyConversion(u"home2", "calendar2", "2-2.3.ics", ("attach_1_3.txt",))
+        yield self._verifyNoConversion(u"home2", "calendar3", "2-3.2.ics", ("attach_1_4.txt",))
+        yield self._verifyNoConversion(u"home2", "calendar3", "2-3.3.ics", ("attach_1_4.txt",))
 
 
     @inlineCallbacks
@@ -1808,14 +1808,14 @@
         yield calstore._upgradeDropbox(txn, "1.4.dropbox")
         yield txn.commit()
 
-        yield self._verifyNoConversion("home1", "calendar1", "1.2.ics", ("attach_1_2_1.txt", "attach_1_2_2.txt",))
-        yield self._verifyNoConversion("home1", "calendar1", "1.3.ics", ("attach_1_3.txt",))
-        yield self._verifyConversion("home1", "calendar1", "1.4.ics", ("attach_1_4.txt",))
-        yield self._verifyConversion("home1", "calendar1", "1.5.ics", ("attach_1_4.txt",))
-        yield self._verifyNoConversion("home2", "calendar2", "2-2.2.ics", ("attach_2_2.txt",))
-        yield self._verifyNoConversion("home2", "calendar2", "2-2.3.ics", ("attach_1_3.txt",))
-        yield self._verifyConversion("home2", "calendar3", "2-3.2.ics", ("attach_1_4.txt",))
-        yield self._verifyConversion("home2", "calendar3", "2-3.3.ics", ("attach_1_4.txt",))
+        yield self._verifyNoConversion(u"home1", "calendar1", "1.2.ics", ("attach_1_2_1.txt", "attach_1_2_2.txt",))
+        yield self._verifyNoConversion(u"home1", "calendar1", "1.3.ics", ("attach_1_3.txt",))
+        yield self._verifyConversion(u"home1", "calendar1", "1.4.ics", ("attach_1_4.txt",))
+        yield self._verifyConversion(u"home1", "calendar1", "1.5.ics", ("attach_1_4.txt",))
+        yield self._verifyNoConversion(u"home2", "calendar2", "2-2.2.ics", ("attach_2_2.txt",))
+        yield self._verifyNoConversion(u"home2", "calendar2", "2-2.3.ics", ("attach_1_3.txt",))
+        yield self._verifyConversion(u"home2", "calendar3", "2-3.2.ics", ("attach_1_4.txt",))
+        yield self._verifyConversion(u"home2", "calendar3", "2-3.3.ics", ("attach_1_4.txt",))
 
 
     @inlineCallbacks
@@ -1830,14 +1830,14 @@
         calstore = CalendarStoreFeatures(self._sqlCalendarStore)
         yield calstore.upgradeToManagedAttachments(2)
 
-        yield self._verifyConversion("home1", "calendar1", "1.2.ics", ("attach_1_2_1.txt", "attach_1_2_2.txt",))
-        yield self._verifyConversion("home1", "calendar1", "1.3.ics", ("attach_1_3.txt",))
-        yield self._verifyConversion("home1", "calendar1", "1.4.ics", ("attach_1_4.txt",))
-        yield self._verifyConversion("home1", "calendar1", "1.5.ics", ("attach_1_4.txt",))
-        yield self._verifyConversion("home2", "calendar2", "2-2.2.ics", ("attach_2_2.txt",))
-        yield self._verifyConversion("home2", "calendar2", "2-2.3.ics", ("attach_1_3.txt",))
-        yield self._verifyConversion("home2", "calendar3", "2-3.2.ics", ("attach_1_4.txt",))
-        yield self._verifyConversion("home2", "calendar3", "2-3.3.ics", ("attach_1_4.txt",))
+        yield self._verifyConversion(u"home1", "calendar1", "1.2.ics", ("attach_1_2_1.txt", "attach_1_2_2.txt",))
+        yield self._verifyConversion(u"home1", "calendar1", "1.3.ics", ("attach_1_3.txt",))
+        yield self._verifyConversion(u"home1", "calendar1", "1.4.ics", ("attach_1_4.txt",))
+        yield self._verifyConversion(u"home1", "calendar1", "1.5.ics", ("attach_1_4.txt",))
+        yield self._verifyConversion(u"home2", "calendar2", "2-2.2.ics", ("attach_2_2.txt",))
+        yield self._verifyConversion(u"home2", "calendar2", "2-2.3.ics", ("attach_1_3.txt",))
+        yield self._verifyConversion(u"home2", "calendar3", "2-3.2.ics", ("attach_1_4.txt",))
+        yield self._verifyConversion(u"home2", "calendar3", "2-3.3.ics", ("attach_1_4.txt",))
 
         # Paths do not exist
         for path in self.paths.values():

Modified: CalendarServer/branches/users/sagen/move2who-2/txdav/common/datastore/file.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-2/txdav/common/datastore/file.py	2014-03-10 18:20:46 UTC (rev 12866)
+++ CalendarServer/branches/users/sagen/move2who-2/txdav/common/datastore/file.py	2014-03-10 20:06:08 UTC (rev 12867)
@@ -700,7 +700,7 @@
 
 
     def directoryRecord(self):
-        return self.directoryService().recordWithUID(self.uid())
+        return self.directoryService().recordWithUID(self.uid().decode("utf-8"))
 
 
     def retrieveOldShares(self):

Modified: CalendarServer/branches/users/sagen/move2who-2/txdav/common/datastore/podding/conduit.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-2/txdav/common/datastore/podding/conduit.py	2014-03-10 18:20:46 UTC (rev 12866)
+++ CalendarServer/branches/users/sagen/move2who-2/txdav/common/datastore/podding/conduit.py	2014-03-10 20:06:08 UTC (rev 12867)
@@ -77,30 +77,30 @@
 
 
     @inlineCallbacks
-    def validRequest(self, source_guid, destination_guid):
+    def validRequest(self, source_uid, destination_uid):
         """
-        Verify that the specified GUIDs are valid for the request and return the
+        Verify that the specified uids are valid for the request and return the
         matching directory records.
 
-        @param source_guid: GUID for the user on whose behalf the request is being made
-        @type source_guid: C{str}
-        @param destination_guid: GUID for the user to whom the request is being sent
-        @type destination_guid: C{str}
+        @param source_uid: UID for the user on whose behalf the request is being made
+        @type source_uid: C{str}
+        @param destination_uid: UID for the user to whom the request is being sent
+        @type destination_uid: C{str}
 
         @return: L{Deferred} resulting in C{tuple} of L{IStoreDirectoryRecord}
         """
 
-        source = yield self.store.directoryService().recordWithUID(source_guid)
+        source = yield self.store.directoryService().recordWithUID(source_uid)
         if source is None:
-            raise DirectoryRecordNotFoundError("Cross-pod source: {}".format(source_guid))
+            raise DirectoryRecordNotFoundError("Cross-pod source: {}".format(source_uid))
         if not source.thisServer():
-            raise FailedCrossPodRequestError("Cross-pod source not on this server: {}".format(source_guid))
+            raise FailedCrossPodRequestError("Cross-pod source not on this server: {}".format(source_uid))
 
-        destination = yield self.store.directoryService().recordWithUID(destination_guid)
+        destination = yield self.store.directoryService().recordWithUID(destination_uid)
         if destination is None:
-            raise DirectoryRecordNotFoundError("Cross-pod destination: {}".format(destination_guid))
+            raise DirectoryRecordNotFoundError("Cross-pod destination: {}".format(destination_uid))
         if destination.thisServer():
-            raise FailedCrossPodRequestError("Cross-pod destination on this server: {}".format(destination_guid))
+            raise FailedCrossPodRequestError("Cross-pod destination on this server: {}".format(destination_uid))
 
         returnValue((source, destination,))
 
@@ -167,13 +167,13 @@
 
         @param homeType: Type of home being shared.
         @type homeType: C{int}
-        @param ownerUID: GUID of the sharer.
+        @param ownerUID: UID of the sharer.
         @type ownerUID: C{str}
         @param ownerID: resource ID of the sharer calendar
         @type ownerID: C{int}
         @param ownerName: owner's name of the sharer calendar
         @type ownerName: C{str}
-        @param shareeUID: GUID of the sharee
+        @param shareeUID: UID of the sharee
         @type shareeUID: C{str}
         @param shareUID: Resource/invite ID for sharee
         @type shareUID: C{str}
@@ -251,11 +251,11 @@
 
         @param homeType: Type of home being shared.
         @type homeType: C{int}
-        @param ownerUID: GUID of the sharer.
+        @param ownerUID: UID of the sharer.
         @type ownerUID: C{str}
         @param ownerID: resource ID of the sharer calendar
         @type ownerID: C{int}
-        @param shareeUID: GUID of the sharee
+        @param shareeUID: UID of the sharee
         @type shareeUID: C{str}
         @param shareUID: Resource/invite ID for sharee
         @type shareUID: C{str}
@@ -314,9 +314,9 @@
 
         @param homeType: Type of home being shared.
         @type homeType: C{int}
-        @param ownerUID: GUID of the sharer.
+        @param ownerUID: UID of the sharer.
         @type ownerUID: C{str}
-        @param shareeUID: GUID of the recipient
+        @param shareeUID: UID of the recipient
         @type shareeUID: C{str}
         @param shareUID: Resource/invite ID for recipient
         @type shareUID: C{str}

Modified: CalendarServer/branches/users/sagen/move2who-2/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-2/txdav/common/datastore/sql.py	2014-03-10 18:20:46 UTC (rev 12866)
+++ CalendarServer/branches/users/sagen/move2who-2/txdav/common/datastore/sql.py	2014-03-10 20:06:08 UTC (rev 12867)
@@ -2907,6 +2907,9 @@
     @classmethod
     @inlineCallbacks
     def homeWithUID(cls, txn, uid, create=False):
+        """
+        @param uid: I'm going to assume uid is utf-8 encoded bytes
+        """
         homeObject = yield cls.makeClass(txn, uid)
         if homeObject is not None:
             returnValue(homeObject)
@@ -2915,7 +2918,7 @@
                 returnValue(None)
 
             # Determine if the user is local or external
-            record = yield txn.directoryService().recordWithUID(uid)
+            record = yield txn.directoryService().recordWithUID(uid.decode("utf-8"))
             if record is None:
                 raise DirectoryRecordNotFoundError("Cannot create home for UID since no directory record exists: {}".format(uid))
 
@@ -3009,7 +3012,7 @@
 
 
     def directoryRecord(self):
-        return self.directoryService().recordWithUID(self.uid())
+        return self.directoryService().recordWithUID(self.uid().decode("utf-8"))
 
 
     @inlineCallbacks
@@ -6909,6 +6912,9 @@
     @classmethod
     @inlineCallbacks
     def notificationsWithUID(cls, txn, uid, create):
+        """
+        @param uid: I'm going to assume uid is utf-8 encoded bytes
+        """
         rows = yield cls._resourceIDFromUIDQuery.on(txn, uid=uid)
 
         if rows:
@@ -6916,7 +6922,7 @@
             created = False
         elif create:
             # Determine if the user is local or external
-            record = yield txn.directoryService().recordWithUID(uid)
+            record = yield txn.directoryService().recordWithUID(uid.decode("utf-8"))
             if record is None:
                 raise DirectoryRecordNotFoundError("Cannot create home for UID since no directory record exists: {}".format(uid))
 

Modified: CalendarServer/branches/users/sagen/move2who-2/txdav/dps/test/test_client.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-2/txdav/dps/test/test_client.py	2014-03-10 18:20:46 UTC (rev 12866)
+++ CalendarServer/branches/users/sagen/move2who-2/txdav/dps/test/test_client.py	2014-03-10 20:06:08 UTC (rev 12867)
@@ -25,17 +25,34 @@
 from twisted.trial import unittest
 from txdav.dps.client import DirectoryService
 from txdav.dps.server import DirectoryProxyAMPProtocol
+from txdav.who.directory import CalendarDirectoryServiceMixin
 
 
 testMode = "xml"  # "xml" or "od"
 if testMode == "xml":
     from txdav.who.xml import DirectoryService as XMLDirectoryService
+
+    # Mix in the calendar-specific service methods
+    class CalendarXMLDirectorySerivce(
+        XMLDirectoryService,
+        CalendarDirectoryServiceMixin
+    ):
+        pass
+
 elif testMode == "od":
     odpw = "secret"
     from twext.who.opendirectory import DirectoryService as OpenDirectoryService
 
+    # Mix in the calendar-specific service methods
+    class CalendarODDirectorySerivce(
+        OpenDirectoryService,
+        CalendarDirectoryServiceMixin
+    ):
+        pass
 
 
+
+
 class DPSClientTest(unittest.TestCase):
 
     def setUp(self):
@@ -46,9 +63,9 @@
         # The "remote" directory service
         if testMode == "xml":
             path = os.path.join(os.path.dirname(__file__), "test.xml")
-            remoteDirectory = XMLDirectoryService(FilePath(path))
+            remoteDirectory = CalendarXMLDirectorySerivce(FilePath(path))
         elif testMode == "od":
-            remoteDirectory = OpenDirectoryService()
+            remoteDirectory = CalendarODDirectorySerivce()
 
         # Connect the two services directly via an IOPump
         client = AMP()

Modified: CalendarServer/branches/users/sagen/move2who-2/txdav/who/augment.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-2/txdav/who/augment.py	2014-03-10 18:20:46 UTC (rev 12866)
+++ CalendarServer/branches/users/sagen/move2who-2/txdav/who/augment.py	2014-03-10 20:06:08 UTC (rev 12867)
@@ -19,20 +19,22 @@
 Augmenting Directory Service
 """
 
-from twext.who.idirectory import IDirectoryService, RecordType
+from twext.python.log import Logger
 from twext.who.directory import DirectoryRecord
 from twext.who.directory import DirectoryService as BaseDirectoryService
+from twext.who.idirectory import IDirectoryService, RecordType
 from twext.who.util import ConstantsContainer
+from twisted.internet.defer import inlineCallbacks, returnValue
+from txdav.common.idirectoryservice import IStoreDirectoryService
+from txdav.who.delegates import RecordType as DelegateRecordType
 from txdav.who.directory import (
     CalendarDirectoryRecordMixin, CalendarDirectoryServiceMixin
 )
 from txdav.who.idirectory import AutoScheduleMode, FieldName
 from txdav.who.idirectory import RecordType as CalRecordType
-from txdav.who.delegates import RecordType as DelegateRecordType
-from twisted.internet.defer import inlineCallbacks, returnValue
 from zope.interface import implementer
 
-from twext.python.log import Logger
+
 log = Logger()
 
 
@@ -66,7 +68,7 @@
         returnValue(augmented)
 
 
- at implementer(IDirectoryService)
+ at implementer(IDirectoryService, IStoreDirectoryService)
 class AugmentedDirectoryService(BaseDirectoryService,
                                 CalendarDirectoryServiceMixin):
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140310/d6b7ab60/attachment-0001.html>


More information about the calendarserver-changes mailing list