[CalendarServer-changes] [995] CalendarServer/trunk/twistedcaldav/directory/principal.py

source_changes at macosforge.org source_changes at macosforge.org
Mon Jan 8 20:31:57 PST 2007


Revision: 995
          http://trac.macosforge.org/projects/calendarserver/changeset/995
Author:   wsanchez at apple.com
Date:     2007-01-08 20:31:56 -0800 (Mon, 08 Jan 2007)

Log Message:
-----------
Add principalForGUID(), and add principalForShortName() to type resource

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/directory/principal.py

Modified: CalendarServer/trunk/twistedcaldav/directory/principal.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/principal.py	2007-01-09 04:15:20 UTC (rev 994)
+++ CalendarServer/trunk/twistedcaldav/directory/principal.py	2007-01-09 04:31:56 UTC (rev 995)
@@ -81,7 +81,7 @@
         self.directory = IDirectoryService(directory)
 
         # FIXME: Smells like a hack
-        directory.principalCollection = self
+        self.directory.principalCollection = self
 
         # Create children
         for recordType in self.directory.recordTypes():
@@ -94,9 +94,11 @@
         return typeResource.getChild(name)
 
     def principalForUser(self, user):
-        return self.principalForShortName(DirectoryService.recordType_users, 
-                                          user)
+        return self.principalForShortName(DirectoryService.recordType_users, user)
 
+    def principalForGUID(self, guid):
+        return self.principalForRecord(self.directory.recordWithGUID(guid))
+
     def principalForRecord(self, record):
         return self.principalForShortName(record.recordType, record.shortName)
 
@@ -179,12 +181,18 @@
         self.recordType = recordType
         self.parent = parent
 
+    def principalForShortName(self, type, name):
+        return self.parent.principalForShortName(type, name)
+
     def principalForUser(self, user):
         return self.parent.principalForUser(user)
 
     def principalForRecord(self, record):
         return self.parent.principalForRecord(record)
 
+    def principalForGUID(self, guid):
+        return self.parent.principalForGUID(guid)
+
     def principalForCalendarUserAddress(self, address):
         return self.parent.principalForCalendarUserAddress(address)
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070108/beabda7e/attachment.html


More information about the calendarserver-changes mailing list