[CalendarServer-changes] [13088] CalendarServer/branches/users/sagen/move2who-4/txdav/who/directory. py

source_changes at macosforge.org source_changes at macosforge.org
Tue Apr 1 09:08:48 PDT 2014


Revision: 13088
          http://trac.calendarserver.org//changeset/13088
Author:   sagen at apple.com
Date:     2014-04-01 09:08:48 -0700 (Tue, 01 Apr 2014)
Log Message:
-----------
Bring serverURI, server, and thisServer methods over to new directory

Modified Paths:
--------------
    CalendarServer/branches/users/sagen/move2who-4/txdav/who/directory.py

Modified: CalendarServer/branches/users/sagen/move2who-4/txdav/who/directory.py
===================================================================
--- CalendarServer/branches/users/sagen/move2who-4/txdav/who/directory.py	2014-04-01 14:23:25 UTC (rev 13087)
+++ CalendarServer/branches/users/sagen/move2who-4/txdav/who/directory.py	2014-04-01 16:08:48 UTC (rev 13088)
@@ -27,12 +27,14 @@
 from twext.who.idirectory import RecordType as BaseRecordType
 from twisted.cred.credentials import UsernamePassword
 from twisted.internet.defer import inlineCallbacks, returnValue
+from txdav.caldav.datastore.scheduling.ischedule.localservers import Servers
+from txdav.who.delegates import RecordType as DelegateRecordType
 from txdav.who.idirectory import (
     RecordType as DAVRecordType, AutoScheduleMode
 )
-from txdav.who.delegates import RecordType as DelegateRecordType
 from txweb2.auth.digest import DigestedCredentials
 
+
 log = Logger()
 
 
@@ -373,9 +375,35 @@
             return False
 
 
-    # FIXME:
+    def serverURI(self):
+        """
+        URL of the server hosting this record. Return None if hosted on this server.
+        """
+        # FIXME:
+        from twistedcaldav.config import config
+
+        if config.Servers.Enabled and getattr(self, "serviceNodeUID", None):
+            return Servers.getServerURIById(self.serviceNodeUID)
+        else:
+            return None
+
+
+    def server(self):
+        """
+        Server hosting this record. Return None if hosted on this server.
+        """
+        # FIXME:
+        from twistedcaldav.config import config
+
+        if config.Servers.Enabled and getattr(self, "serviceNodeUID", None):
+            return Servers.getServerById(self.serviceNodeUID)
+        else:
+            return None
+
+
     def thisServer(self):
-        return True
+        s = self.server()
+        return s.thisServer if s is not None else True
 
 
     def isLoginEnabled(self):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140401/aa0bb18b/attachment.html>


More information about the calendarserver-changes mailing list