[CalendarServer-changes] [1573] CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py

source_changes at macosforge.org source_changes at macosforge.org
Fri May 25 15:44:43 PDT 2007


Revision: 1573
          http://trac.macosforge.org/projects/calendarserver/changeset/1573
Author:   dreid at apple.com
Date:     2007-05-25 15:44:43 -0700 (Fri, 25 May 2007)

Log Message:
-----------
Check for the apple-serviceinfo attribute first, also use a complex query to get the records containing the virtual host name

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

Modified: CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py	2007-05-25 17:59:23 UTC (rev 1572)
+++ CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py	2007-05-25 22:44:43 UTC (rev 1573)
@@ -124,13 +124,22 @@
             dsattributes.kDSNAttrRecordName,
             dsattributes.kDS1AttrXMLPlist,
             dsattributes.kDSNAttrMetaNodeLocation,
+            'dsAttrTypeNative:apple-serviceinfo',
         ]
 
-        records = opendirectory.queryRecordsWithAttribute(
+        from dsquery import expression, match
+
+        records = opendirectory.queryRecordsWithAttributes(
             self.directory,
-            dsattributes.kDS1AttrXMLPlist,
-            vhostname,
-            dsattributes.eDSContains,
+            expression(
+                expression.OR,
+                (
+                    match(dsattributes.kDS1AttrXMLPlist,
+                          vhostname,
+                          dsattributes.eDSContains),
+                    match('dsAttrTypeNative:apple-serviceinfo',
+                          vhostname,
+                          dsattributes.eDSContains))).generate(),
             True,    # case insentive for hostnames
             dsattributes.kDSStdRecordTypeComputers,
             attrs
@@ -157,11 +166,17 @@
         _remoteNode = None
 
         for recordname, record in records.iteritems():
-            # Must have XMLPlist value
-            plist = record.get(dsattributes.kDS1AttrXMLPlist, None)
+            # May have an apple-serviceinfo
+            plist = record.get('dsAttrTypeNative:apple-serviceinfo', None)
+
             if not plist:
-                continue
+                # May have XMLPlist value
+                plist = record.get(dsattributes.kDS1AttrXMLPlist, None)
 
+                # Must have one of the other
+                if not plist:
+                    continue
+
             # XXX: Parse the plist so we can find only calendar vhosts with our hostname.
             plistDict = readPlistFromString(plist)
             vhosts = plistDict.get("com.apple.macosxserver.virtualhosts", None)

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


More information about the calendarserver-changes mailing list