[CalendarServer-changes] [4866] CalendarServer/branches/users/cdaboo/deployment-partition-4722

source_changes at macosforge.org source_changes at macosforge.org
Wed Dec 16 07:04:03 PST 2009


Revision: 4866
          http://trac.macosforge.org/projects/calendarserver/changeset/4866
Author:   cdaboo at apple.com
Date:     2009-12-16 07:04:00 -0800 (Wed, 16 Dec 2009)
Log Message:
-----------
Sync up with calendar address attribute removal change.

Modified Paths:
--------------
    CalendarServer/branches/users/cdaboo/deployment-partition-4722/conf/augments-test.xml
    CalendarServer/branches/users/cdaboo/deployment-partition-4722/conf/augments.dtd
    CalendarServer/branches/users/cdaboo/deployment-partition-4722/twistedcaldav/directory/augment.py
    CalendarServer/branches/users/cdaboo/deployment-partition-4722/twistedcaldav/directory/directory.py
    CalendarServer/branches/users/cdaboo/deployment-partition-4722/twistedcaldav/directory/test/augments-test-default.xml
    CalendarServer/branches/users/cdaboo/deployment-partition-4722/twistedcaldav/directory/test/augments-test.xml
    CalendarServer/branches/users/cdaboo/deployment-partition-4722/twistedcaldav/directory/test/test_augment.py
    CalendarServer/branches/users/cdaboo/deployment-partition-4722/twistedcaldav/directory/xmlaugmentsparser.py

Modified: CalendarServer/branches/users/cdaboo/deployment-partition-4722/conf/augments-test.xml
===================================================================
--- CalendarServer/branches/users/cdaboo/deployment-partition-4722/conf/augments-test.xml	2009-12-16 02:48:38 UTC (rev 4865)
+++ CalendarServer/branches/users/cdaboo/deployment-partition-4722/conf/augments-test.xml	2009-12-16 15:04:00 UTC (rev 4866)
@@ -33,13 +33,11 @@
     <guid>user%02d</guid>
     <enable>true</enable>
     <enable-calendar>true</enable-calendar>
-    <cuaddr>mailto:user%02d at example.com</cuaddr>
   </record>
   <record repeat="10">
     <guid>public%02d</guid>
     <enable>true</enable>
     <enable-calendar>true</enable-calendar>
-    <cuaddr>mailto:public%02d at example.com</cuaddr>
   </record>
   <record repeat="10">
     <guid>location%02d</guid>

Modified: CalendarServer/branches/users/cdaboo/deployment-partition-4722/conf/augments.dtd
===================================================================
--- CalendarServer/branches/users/cdaboo/deployment-partition-4722/conf/augments.dtd	2009-12-16 02:48:38 UTC (rev 4865)
+++ CalendarServer/branches/users/cdaboo/deployment-partition-4722/conf/augments.dtd	2009-12-16 15:04:00 UTC (rev 4866)
@@ -16,7 +16,7 @@
 
 <!ELEMENT augments (record*) >
 
-  <!ELEMENT record (guid, enable, hosted-at?, enable-calendar?, auto-schedule?, cuaddr*)>
+  <!ELEMENT record (guid, enable, hosted-at?, enable-calendar?, auto-schedule?)>
     <!ATTLIST record repeat CDATA "1">
 
   <!ELEMENT guid              (#PCDATA)>
@@ -24,5 +24,4 @@
   <!ELEMENT hosted-at         (#PCDATA)>
   <!ELEMENT enable-calendar   (#PCDATA)>
   <!ELEMENT auto-schedule     (#PCDATA)>
-  <!ELEMENT cuaddr            (#PCDATA)>
 >

Modified: CalendarServer/branches/users/cdaboo/deployment-partition-4722/twistedcaldav/directory/augment.py
===================================================================
--- CalendarServer/branches/users/cdaboo/deployment-partition-4722/twistedcaldav/directory/augment.py	2009-12-16 02:48:38 UTC (rev 4865)
+++ CalendarServer/branches/users/cdaboo/deployment-partition-4722/twistedcaldav/directory/augment.py	2009-12-16 15:04:00 UTC (rev 4866)
@@ -38,14 +38,12 @@
         hostedAt="",
         enabledForCalendaring=False,
         autoSchedule=False,
-        calendarUserAddresses=None,  
     ):
         self.guid = guid
         self.enabled = enabled
         self.hostedAt = hostedAt
         self.enabledForCalendaring = enabledForCalendaring
         self.autoSchedule = autoSchedule
-        self.calendarUserAddresses = calendarUserAddresses if calendarUserAddresses else set()
 
 class AugmentDB(object):
     """
@@ -212,11 +210,11 @@
         """
         
         # Query for the record information
-        results = (yield self.query("select GUID, ENABLED, PARTITIONID, CALENDARING, AUTOSCHEDULE, CUADDRS from AUGMENTS where GUID = :1", (guid,)))
+        results = (yield self.query("select GUID, ENABLED, PARTITIONID, CALENDARING, AUTOSCHEDULE from AUGMENTS where GUID = :1", (guid,)))
         if not results:
             returnValue(None)
         else:
-            guid, enabled, partitionid, enabdledForCalendaring, autoSchedule, cuaddrs = results[0]
+            guid, enabled, partitionid, enabdledForCalendaring, autoSchedule = results[0]
             
             record = AugmentRecord(
                 guid = guid,
@@ -224,7 +222,6 @@
                 hostedAt = (yield self._getPartition(partitionid)),
                 enabledForCalendaring = enabdledForCalendaring == "T",
                 autoSchedule = autoSchedule == "T",
-                calendarUserAddresses = set(cuaddrs.split("\t")) if cuaddrs else set(),
             )
             
             returnValue(record)
@@ -233,35 +230,33 @@
     def addAugmentRecord(self, record, update=False):
 
         partitionid = (yield self._getPartitionID(record.hostedAt))
-        cuaddrs = "\t".join(record.calendarUserAddresses)
         
         if update:
             yield self.execute(
                 """update AUGMENTS set
-                   (GUID, ENABLED, PARTITIONID, CALENDARING, AUTOSCHEDULE, CUADDRS) =
-                   (:1, :2, :3, :4, :5, :6) where GUID = :7""",
+                   (GUID, ENABLED, PARTITIONID, CALENDARING, AUTOSCHEDULE) =
+                   (:1, :2, :3, :4, :5) where GUID = :6""",
                 (
                     record.guid,
                     "T" if record.enabled else "F",
                     partitionid,
                     "T" if record.enabledForCalendaring else "F",
                     "T" if record.autoSchedule else "F",
-                    cuaddrs,
                     record.guid,
                 )
             )
         else:
             yield self.execute(
                 """insert into AUGMENTS
-                   (GUID, ENABLED, PARTITIONID, CALENDARING, AUTOSCHEDULE, CUADDRS)
-                   values (:1, :2, :3, :4, :5, :6)""",
+                   (GUID, ENABLED, PARTITIONID, CALENDARING, AUTOSCHEDULE)
+                   values (:1, :2, :3, :4, :5)""",
                 (
                     record.guid,
                     "T" if record.enabled else "F",
                     partitionid,
                     "T" if record.enabledForCalendaring else "F",
                     "T" if record.autoSchedule else "F",
-                    cuaddrs,)
+                )
             )
 
     def removeAugmentRecord(self, guid):
@@ -297,11 +292,6 @@
         self.cachedPartitions[partitionid] = partition
         returnValue(partition)
 
-    @inlineCallbacks
-    def _getCUAddrs(self, augmentid):
-        
-        return self.queryList("select CUADDR from CUADDRS where AUGMENTID = :1", (augmentid,))
-
     def _db_version(self):
         """
         @return: the schema version assigned to this index.
@@ -329,7 +319,6 @@
             ("PARTITIONID",  "text"),
             ("CALENDARING",  "text(1)"),
             ("AUTOSCHEDULE", "text(1)"),
-            ("CUADDRS",      "text"),
         ))
 
         yield self._create_table("PARTITIONS", (

Modified: CalendarServer/branches/users/cdaboo/deployment-partition-4722/twistedcaldav/directory/directory.py
===================================================================
--- CalendarServer/branches/users/cdaboo/deployment-partition-4722/twistedcaldav/directory/directory.py	2009-12-16 02:48:38 UTC (rev 4865)
+++ CalendarServer/branches/users/cdaboo/deployment-partition-4722/twistedcaldav/directory/directory.py	2009-12-16 15:04:00 UTC (rev 4866)
@@ -185,8 +185,24 @@
         self.emailAddresses        = emailAddresses
         self.enabledForCalendaring = False
         self.autoSchedule          = False
-        self.calendarUserAddresses = set()
 
+    def get_calendarUserAddresses(self):
+        """
+        Dynamically construct a calendarUserAddresses attribute which describes
+        this L{DirectoryRecord}.
+
+        @see: L{IDirectoryRecord.calendarUserAddresses}.
+        """
+        if not self.enabledForCalendaring:
+            return frozenset()
+        return frozenset(
+            ["urn:uuid:%s" % (self.guid,)] +
+            ["mailto:%s" % (emailAddress,)
+             for emailAddress in self.emailAddresses]
+        )
+
+    calendarUserAddresses = property(get_calendarUserAddresses)
+
     def __cmp__(self, other):
         if not isinstance(other, DirectoryRecord):
             return NotImplemented
@@ -212,24 +228,15 @@
             self.hostedAt = augment.hostedAt
             self.enabledForCalendaring = augment.enabledForCalendaring
             self.autoSchedule = augment.autoSchedule
-            self.calendarUserAddresses = set(augment.calendarUserAddresses)
 
             if self.enabledForCalendaring and self.recordType == self.service.recordType_groups:
                 self.log_error("Group '%s(%s)' cannot be enabled for calendaring" % (self.guid, self.shortName,))
                 self.enabledForCalendaring = False
-    
-            if self.enabledForCalendaring:
-                for email in self.emailAddresses:
-                    self.calendarUserAddresses.add("mailto:%s" % (email.lower(),))
-                self.calendarUserAddresses.add("urn:uuid:%s" % (self.guid,))
-            else:
-                assert len(self.calendarUserAddresses) == 0
 
         else:
             self.enabled = False
             self.hostedAt = ""
             self.enabledForCalendaring = False
-            self.calendarUserAddresses = set()
 
     def members(self):
         return ()

Modified: CalendarServer/branches/users/cdaboo/deployment-partition-4722/twistedcaldav/directory/test/augments-test-default.xml
===================================================================
--- CalendarServer/branches/users/cdaboo/deployment-partition-4722/twistedcaldav/directory/test/augments-test-default.xml	2009-12-16 02:48:38 UTC (rev 4865)
+++ CalendarServer/branches/users/cdaboo/deployment-partition-4722/twistedcaldav/directory/test/augments-test-default.xml	2009-12-16 15:04:00 UTC (rev 4866)
@@ -33,7 +33,6 @@
     <guid>6423F94A-6B76-4A3A-815B-D52CFD77935D</guid>
     <enable>true</enable>
     <enable-calendar>true</enable-calendar>
-    <cuaddr>mailto:wsanchez at example.com</cuaddr>
   </record>
   <record>
     <guid>5A985493-EE2C-4665-94CF-4DFEA3A89500</guid>
@@ -61,8 +60,5 @@
     <enable>true</enable>
     <enable-calendar>true</enable-calendar>
     <auto-schedule>true</auto-schedule>
-    <cuaddr>mailto:usera at example.com</cuaddr>
-    <cuaddr>mailto:user.a at example.com</cuaddr>
-    <cuaddr>mailto:user_a at example.com</cuaddr>
   </record>
 </augments>

Modified: CalendarServer/branches/users/cdaboo/deployment-partition-4722/twistedcaldav/directory/test/augments-test.xml
===================================================================
--- CalendarServer/branches/users/cdaboo/deployment-partition-4722/twistedcaldav/directory/test/augments-test.xml	2009-12-16 02:48:38 UTC (rev 4865)
+++ CalendarServer/branches/users/cdaboo/deployment-partition-4722/twistedcaldav/directory/test/augments-test.xml	2009-12-16 15:04:00 UTC (rev 4866)
@@ -27,7 +27,6 @@
     <guid>6423F94A-6B76-4A3A-815B-D52CFD77935D</guid>
     <enable>true</enable>
     <enable-calendar>true</enable-calendar>
-    <cuaddr>mailto:wsanchez at example.com</cuaddr>
   </record>
   <record>
     <guid>5A985493-EE2C-4665-94CF-4DFEA3A89500</guid>
@@ -55,8 +54,5 @@
     <enable>true</enable>
     <enable-calendar>true</enable-calendar>
     <auto-schedule>true</auto-schedule>
-    <cuaddr>mailto:usera at example.com</cuaddr>
-    <cuaddr>mailto:user.a at example.com</cuaddr>
-    <cuaddr>mailto:user_a at example.com</cuaddr>
   </record>
 </augments>

Modified: CalendarServer/branches/users/cdaboo/deployment-partition-4722/twistedcaldav/directory/test/test_augment.py
===================================================================
--- CalendarServer/branches/users/cdaboo/deployment-partition-4722/twistedcaldav/directory/test/test_augment.py	2009-12-16 02:48:38 UTC (rev 4865)
+++ CalendarServer/branches/users/cdaboo/deployment-partition-4722/twistedcaldav/directory/test/test_augment.py	2009-12-16 15:04:00 UTC (rev 4866)
@@ -26,16 +26,16 @@
 xmlFileDefault = os.path.join(os.path.dirname(__file__), "augments-test-default.xml")
 
 testRecords = (
-    {"guid":"D11F03A0-97EA-48AF-9A6C-FAC7F3975766", "enabled":True,  "hostedAt":"", "enabledForCalendaring":False, "autoSchedule":False, "calendarUserAddresses":set()},
-    {"guid":"6423F94A-6B76-4A3A-815B-D52CFD77935D", "enabled":True,  "hostedAt":"", "enabledForCalendaring":True, "autoSchedule":False, "calendarUserAddresses":set(("mailto:wsanchez at example.com",))},
-    {"guid":"5A985493-EE2C-4665-94CF-4DFEA3A89500", "enabled":False, "hostedAt":"", "enabledForCalendaring":False, "autoSchedule":False, "calendarUserAddresses":set()},
-    {"guid":"8B4288F6-CC82-491D-8EF9-642EF4F3E7D0", "enabled":True,  "hostedAt":"", "enabledForCalendaring":False, "autoSchedule":False, "calendarUserAddresses":set()},
-    {"guid":"5FF60DAD-0BDE-4508-8C77-15F0CA5C8DD1", "enabled":True,  "hostedAt":"00001", "enabledForCalendaring":False, "autoSchedule":False, "calendarUserAddresses":set()},
-    {"guid":"543D28BA-F74F-4D5F-9243-B3E3A61171E5", "enabled":True,  "hostedAt":"00002", "enabledForCalendaring":False, "autoSchedule":False, "calendarUserAddresses":set()},
-    {"guid":"6A73326A-F781-47E7-A9F8-AF47364D4152", "enabled":True,  "hostedAt":"00002", "enabledForCalendaring":True, "autoSchedule":True, "calendarUserAddresses":set(("mailto:usera at example.com", "mailto:user.a at example.com", "mailto:user_a at example.com",))},
+    {"guid":"D11F03A0-97EA-48AF-9A6C-FAC7F3975766", "enabled":True,  "hostedAt":"", "enabledForCalendaring":False, "autoSchedule":False},
+    {"guid":"6423F94A-6B76-4A3A-815B-D52CFD77935D", "enabled":True,  "hostedAt":"", "enabledForCalendaring":True, "autoSchedule":False},
+    {"guid":"5A985493-EE2C-4665-94CF-4DFEA3A89500", "enabled":False, "hostedAt":"", "enabledForCalendaring":False, "autoSchedule":False},
+    {"guid":"8B4288F6-CC82-491D-8EF9-642EF4F3E7D0", "enabled":True,  "hostedAt":"", "enabledForCalendaring":False, "autoSchedule":False},
+    {"guid":"5FF60DAD-0BDE-4508-8C77-15F0CA5C8DD1", "enabled":True,  "hostedAt":"00001", "enabledForCalendaring":False, "autoSchedule":False},
+    {"guid":"543D28BA-F74F-4D5F-9243-B3E3A61171E5", "enabled":True,  "hostedAt":"00002", "enabledForCalendaring":False, "autoSchedule":False},
+    {"guid":"6A73326A-F781-47E7-A9F8-AF47364D4152", "enabled":True,  "hostedAt":"00002", "enabledForCalendaring":True, "autoSchedule":True},
 )
 
-testRecordDefault = {"guid":"A4318887-F2C7-4A70-9056-B88CC8DB26F1", "enabled":True,  "hostedAt":"00001", "enabledForCalendaring":True, "autoSchedule":False, "calendarUserAddresses":set()}
+testRecordDefault = {"guid":"A4318887-F2C7-4A70-9056-B88CC8DB26F1", "enabled":True,  "hostedAt":"00001", "enabledForCalendaring":True, "autoSchedule":False}
 
 class AugmentTests(TestCase):
 

Modified: CalendarServer/branches/users/cdaboo/deployment-partition-4722/twistedcaldav/directory/xmlaugmentsparser.py
===================================================================
--- CalendarServer/branches/users/cdaboo/deployment-partition-4722/twistedcaldav/directory/xmlaugmentsparser.py	2009-12-16 02:48:38 UTC (rev 4865)
+++ CalendarServer/branches/users/cdaboo/deployment-partition-4722/twistedcaldav/directory/xmlaugmentsparser.py	2009-12-16 15:04:00 UTC (rev 4866)
@@ -38,7 +38,6 @@
 ELEMENT_HOSTEDAT          = "hosted-at"
 ELEMENT_ENABLECALENDAR    = "enable-calendar"
 ELEMENT_AUTOSCHEDULE      = "auto-schedule"
-ELEMENT_CUADDR            = "cuaddr"
 
 ATTRIBUTE_REPEAT          = "repeat"
 
@@ -51,7 +50,6 @@
     ELEMENT_HOSTEDAT:       "hostedAt",
     ELEMENT_ENABLECALENDAR: "enabledForCalendaring",
     ELEMENT_AUTOSCHEDULE:   "autoSchedule",
-    ELEMENT_CUADDR:         "calendarUserAddresses",
 }
 
 class XMLAugmentsParser(object):
@@ -105,8 +103,6 @@
                     ELEMENT_AUTOSCHEDULE,
                 ):
                     fields[node.tag] = node.text == VALUE_TRUE
-                elif node.tag == ELEMENT_CUADDR:
-                    fields.setdefault(node.tag, set()).add(node.text)
                 else:
                     log.error("Invalid element '%s' in augment file: '%s'" % (node.tag, self.xmlFile,), raiseException=RuntimeError)
                     
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20091216/8551b764/attachment-0001.html>


More information about the calendarserver-changes mailing list