[CalendarServer-changes] [10685] CalendarServer/trunk/twext/who

source_changes at macosforge.org source_changes at macosforge.org
Mon Feb 11 13:55:48 PST 2013


Revision: 10685
          http://trac.calendarserver.org//changeset/10685
Author:   wsanchez at apple.com
Date:     2013-02-11 13:55:48 -0800 (Mon, 11 Feb 2013)
Log Message:
-----------
Fold IMutableDirectoryService into IDirectoryService.

Modified Paths:
--------------
    CalendarServer/trunk/twext/who/directory.py
    CalendarServer/trunk/twext/who/idirectory.py
    CalendarServer/trunk/twext/who/xml.py

Modified: CalendarServer/trunk/twext/who/directory.py
===================================================================
--- CalendarServer/trunk/twext/who/directory.py	2013-02-11 21:45:31 UTC (rev 10684)
+++ CalendarServer/trunk/twext/who/directory.py	2013-02-11 21:55:48 UTC (rev 10685)
@@ -29,7 +29,7 @@
 from twisted.internet.defer import inlineCallbacks, returnValue
 from twisted.internet.defer import succeed, fail
 
-from twext.who.idirectory import QueryNotSupportedError
+from twext.who.idirectory import QueryNotSupportedError, NotAllowedError
 from twext.who.idirectory import FieldName, RecordType
 from twext.who.idirectory import Operand
 from twext.who.idirectory import DirectoryQueryMatchExpression
@@ -124,9 +124,17 @@
 
     def recordsWithEmailAddress(self, emailAddress):
         return self.recordsWithFieldValue(FieldName.emailAddresses, emailAddress)
-               
 
+    def updateRecords(self, records, create=False):
+        for record in records:
+            raise NotAllowedError("Record updates not allowed.")
 
+    def removeRecords(self, uids):
+        for uid in uids:
+            raise NotAllowedError("Record removal not allowed.")
+
+
+
 class DirectoryRecord(FancyEqMixin, object):
     implements(IDirectoryRecord)
 

Modified: CalendarServer/trunk/twext/who/idirectory.py
===================================================================
--- CalendarServer/trunk/twext/who/idirectory.py	2013-02-11 21:45:31 UTC (rev 10684)
+++ CalendarServer/trunk/twext/who/idirectory.py	2013-02-11 21:55:48 UTC (rev 10685)
@@ -23,6 +23,7 @@
     "DirectoryAvailabilityError",
     "QueryNotSupportedError",
     "NoSuchRecordError",
+    "NotAllowedError",
     "RecordType",
     "FieldName",
     "MatchType",
@@ -64,8 +65,13 @@
     Record does not exist.
     """
 
+class NotAllowedError(DirectoryServiceError):
+    """
+    Apparently, you can't do that.
+    """
 
 
+
 ##
 # Data Types
 ##
@@ -267,13 +273,7 @@
             C{None} if there is no such record.
         """
 
-
-
-class IMutableDirectoryService(IDirectoryService):
-    """
-    Mutable directory service.
-    """
-    def updateRecords(self, records, create=False):
+    def updateRecords(records, create=False):
         """
         Updates existing directory records.
         @param records: the records to update
@@ -282,7 +282,7 @@
         @type create: boolean
         """
 
-    def removeRecords(self, uids):
+    def removeRecords(uids):
         """
         Removes the records with the given UIDs.
         @param uids: the UIDs of the records to remove

Modified: CalendarServer/trunk/twext/who/xml.py
===================================================================
--- CalendarServer/trunk/twext/who/xml.py	2013-02-11 21:45:31 UTC (rev 10684)
+++ CalendarServer/trunk/twext/who/xml.py	2013-02-11 21:55:48 UTC (rev 10685)
@@ -417,9 +417,7 @@
         # Drop cached data and load the XML DOM.
         #
         self.flush()
-
         etree = self.loadRecords(loadNow=True)
-
         directoryNode = etree.getroot()
 
         def fillRecordNode(recordNode, record):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130211/b0af5971/attachment-0001.html>


More information about the calendarserver-changes mailing list