[CalendarServer-changes] [1921] PyOpenDirectory/branches/users/cdaboo/multiple-computer-records-1917

source_changes at macosforge.org source_changes at macosforge.org
Thu Sep 27 14:20:05 PDT 2007


Revision: 1921
          http://trac.macosforge.org/projects/calendarserver/changeset/1921
Author:   cdaboo at apple.com
Date:     2007-09-27 14:20:05 -0700 (Thu, 27 Sep 2007)

Log Message:
-----------
Restore the old dict-based apis for backwards compatability.

Modified Paths:
--------------
    PyOpenDirectory/branches/users/cdaboo/multiple-computer-records-1917/pysrc/opendirectory.py
    PyOpenDirectory/branches/users/cdaboo/multiple-computer-records-1917/src/PythonWrapper.cpp
    PyOpenDirectory/branches/users/cdaboo/multiple-computer-records-1917/test.py

Modified: PyOpenDirectory/branches/users/cdaboo/multiple-computer-records-1917/pysrc/opendirectory.py
===================================================================
--- PyOpenDirectory/branches/users/cdaboo/multiple-computer-records-1917/pysrc/opendirectory.py	2007-09-27 19:22:04 UTC (rev 1920)
+++ PyOpenDirectory/branches/users/cdaboo/multiple-computer-records-1917/pysrc/opendirectory.py	2007-09-27 21:20:05 UTC (rev 1921)
@@ -36,11 +36,50 @@
     @param obj: C{object} the object obtained from an odInit call.
     @param recordType: C{str} containing the OD record type to lookup.
     @param attributes: C{list} containing the attributes to return for each record.
+    @return: C{dict} containing a C{dict} of attributes for each record found,  
+        or C{None} otherwise.
+    """
+
+def queryRecordsWithAttribute(obj, attr, value, matchType, casei, recordType, attributes):
+    """
+    List records in Open Directory matching specified attribute/value, and return key attributes for each one.
+    
+    @param obj: C{object} the object obtained from an odInit call.
+    @param attr: C{str} containing the attribute to search.
+    @param value: C{str} containing the value to search for.
+    @param matchType: C{int} DS match type to use when searching.
+    @param casei: C{True} to do case-insenstive match, C{False} otherwise.
+    @param recordType: C{str} containing the OD record type to lookup.
+    @param attributes: C{list} containing the attributes to return for each record.
+    @return: C{dict} containing a C{dict} of attributes for each record found,  
+        or C{None} otherwise.
+    """
+
+def queryRecordsWithAttributes(obj, compound, casei, recordType, attributes):
+    """
+    List records in Open Directory matching specified criteria, and return key attributes for each one.
+    
+    @param obj: C{object} the object obtained from an odInit call.
+    @param compound: C{str} containing the compound search query to use.
+    @param casei: C{True} to do case-insenstive match, C{False} otherwise.
+    @param recordType: C{str} containing the OD record type to lookup.
+    @param attributes: C{list} containing the attributes to return for each record.
+    @return: C{dict} containing a C{dict} of attributes for each record found,  
+        or C{None} otherwise.
+    """
+
+def listAllRecordsWithAttributes_list(obj, recordType, attributes):
+    """
+    List records in Open Directory, and return key attributes for each one.
+    
+    @param obj: C{object} the object obtained from an odInit call.
+    @param recordType: C{str} containing the OD record type to lookup.
+    @param attributes: C{list} containing the attributes to return for each record.
     @return: C{list} containing a C{list} of C{str} (record name) and C{dict} attributes 
          for each record found, or C{None} otherwise.
     """
 
-def queryRecordsWithAttribute(obj, attr, value, matchType, casei, recordType, attributes):
+def queryRecordsWithAttribute_list(obj, attr, value, matchType, casei, recordType, attributes):
     """
     List records in Open Directory matching specified attribute/value, and return key attributes for each one.
     
@@ -55,7 +94,7 @@
          for each record found, or C{None} otherwise.
     """
 
-def queryRecordsWithAttributes(obj, compound, casei, recordType, attributes):
+def queryRecordsWithAttributes_list(obj, compound, casei, recordType, attributes):
     """
     List records in Open Directory matching specified criteria, and return key attributes for each one.
     

Modified: PyOpenDirectory/branches/users/cdaboo/multiple-computer-records-1917/src/PythonWrapper.cpp
===================================================================
--- PyOpenDirectory/branches/users/cdaboo/multiple-computer-records-1917/src/PythonWrapper.cpp	2007-09-27 19:22:04 UTC (rev 1920)
+++ PyOpenDirectory/branches/users/cdaboo/multiple-computer-records-1917/src/PythonWrapper.cpp	2007-09-27 21:20:05 UTC (rev 1921)
@@ -17,7 +17,7 @@
  **/
 
 #include <CoreFoundation/CoreFoundation.h>
-#include <Python.h>
+#include <Python/Python.h>
 
 #include "CDirectoryService.h"
 #include "CFStringUtil.h"
@@ -175,12 +175,47 @@
 		CFArrayRef nested = (CFArrayRef)CFArrayGetValueAtIndex(list, i);
 		PyObject* pylist = CFArrayStringDictionaryToPyList(nested);
 		if (pylist != NULL)
+		{
 			PyList_SetItem(result, j++, pylist);
+		}
 	}
 	
 	return result;
 }
 
+// Utility function - not exposed to Python
+static void CFArrayStringDictionaryToPyDict(CFArrayRef list, PyObject* result)
+{
+	CFIndex lsize = (list != NULL) ? CFArrayGetCount(list) : 0;
+	if (lsize != 2)
+		return;
+	
+	CFStringRef str = (CFStringRef)CFArrayGetValueAtIndex(list, 0);
+	PyObject* pystrkey = CFStringToPyStr(str);
+	
+	CFDictionaryRef dict = (CFDictionaryRef)CFArrayGetValueAtIndex(list, 1);
+	PyObject* pydictvalue = CFDictionaryToPyDict(dict);
+	
+	PyDict_SetItem(result, pystrkey, pydictvalue);
+	Py_DECREF(pystrkey);
+	Py_DECREF(pydictvalue);
+}
+
+// Utility function - not exposed to Python
+static PyObject* CFArrayArrayDictionaryToPyDict(CFArrayRef list)
+{
+	CFIndex lsize = (list != NULL) ? CFArrayGetCount(list) : 0;
+	
+	PyObject* result = PyDict_New();
+	for(CFIndex i = 0; i < lsize; i++)
+	{
+		CFArrayRef nested = (CFArrayRef)CFArrayGetValueAtIndex(list, i);
+		CFArrayStringDictionaryToPyDict(nested, result);
+	}
+	
+	return result;
+}
+
 PyObject* ODException_class = NULL;
 
 /*
@@ -230,11 +265,183 @@
     @param obj: C{object} the object obtained from an odInit call.
     @param recordType: C{str} containing the OD record type to lookup.
     @param attributes: C{list} containing the attributes to return for each record.
+	@return: C{dict} containing a C{dict} of attributes for each record found,  
+        or C{None} otherwise.
+ */
+extern "C" PyObject *listAllRecordsWithAttributes(PyObject *self, PyObject *args)
+{
+	PyObject* pyds;
+	const char* recordType;
+	PyObject* attributes;
+    if (!PyArg_ParseTuple(args, "OsO", &pyds, &recordType, &attributes) || !PyCObject_Check(pyds) || !PyList_Check(attributes))
+    {
+		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices listAllRecordsWithAttributes: could not parse arguments", 0));		
+        return NULL;
+    }
+	
+	// Convert list to CFArray of CFString
+	CFArrayRef cfattributes = PyListToCFArray(attributes);
+	if (cfattributes == NULL)
+    {
+		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices listAllRecordsWithAttributes: could not parse attributes list", 0));		
+        return NULL;
+    }
+
+	CDirectoryService* ds = static_cast<CDirectoryService*>(PyCObject_AsVoidPtr(pyds));
+	if (ds != NULL)
+	{
+		CFMutableArrayRef list = ds->ListAllRecordsWithAttributes(recordType, cfattributes);
+		if (list != NULL)
+		{
+			PyObject* result = CFArrayArrayDictionaryToPyDict(list);
+			CFRelease(list);
+			CFRelease(cfattributes);
+			
+			return result;
+		}
+	}
+	else
+		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices listAllRecordsWithAttributes: invalid directory service argument", 0));		
+	
+	CFRelease(cfattributes);
+	return NULL;
+}
+
+/*
+def queryRecordsWithAttribute(obj, attr, value, matchType, casei, recordType, attributes):
+    """
+    List records in Open Directory matching specified attribute and value, and return key attributes for each one.
+    
+    @param obj: C{object} the object obtained from an odInit call.
+    @param attr: C{str} for the attribute to query.
+    @param value: C{str} for the attribute value to query.
+    @param matchType: C{int} DS match type to use when searching.
+    @param casei: C{True} to do case-insenstive match, C{False} otherwise.
+    @param recordType: C{str} containing the OD record type to lookup.
+    @param attributes: C{list} containing the attributes to return for each record.
+	@return: C{dict} containing a C{dict} of attributes for each record found,  
+        or C{None} otherwise.
+    """
+ */
+extern "C" PyObject *queryRecordsWithAttribute(PyObject *self, PyObject *args)
+{
+	PyObject* pyds;
+	const char* attr;
+	const char* value;
+	int matchType;
+	PyObject* caseio;
+	bool casei;
+	const char* recordType;
+	PyObject* attributes;
+    if (!PyArg_ParseTuple(args, "OssiOsO", &pyds, &attr, &value, &matchType, &caseio, &recordType, &attributes) ||
+    	!PyCObject_Check(pyds) || !PyBool_Check(caseio) || !PyList_Check(attributes))
+    {
+		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: could not parse arguments", 0));		
+        return NULL;
+    }
+
+	casei = (caseio == Py_True);
+
+	// Convert list to CFArray of CFString
+	CFArrayRef cfattributes = PyListToCFArray(attributes);
+	if (cfattributes == NULL)
+    {
+		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: could not parse attributes list", 0));		
+        return NULL;
+    }
+
+	CDirectoryService* ds = static_cast<CDirectoryService*>(PyCObject_AsVoidPtr(pyds));
+	if (ds != NULL)
+	{
+		CFMutableArrayRef list = ds->QueryRecordsWithAttribute(attr, value, matchType, casei, recordType, cfattributes);
+		if (list != NULL)
+		{
+			PyObject* result = CFArrayArrayDictionaryToPyDict(list);
+			CFRelease(list);
+			CFRelease(cfattributes);
+			
+			return result;
+		}
+	}
+	else
+		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: invalid directory service argument", 0));		
+	
+	CFRelease(cfattributes);
+	return NULL;
+}
+
+/*
+def queryRecordsWithAttributes(obj, query, casei, recordType, attributes):
+    """
+    List records in Open Directory matching specified compound query, and return key attributes for each one.
+    
+    @param obj: C{object} the object obtained from an odInit call.
+    @param query: C{str} the compound query string.
+    @param casei: C{True} to do case-insenstive match, C{False} otherwise.
+    @param recordType: C{str} containing the OD record type to lookup.
+    @param attributes: C{list} containing the attributes to return for each record.
+	@return: C{dict} containing a C{dict} of attributes for each record found,  
+        or C{None} otherwise.
+    """
+ */
+extern "C" PyObject *queryRecordsWithAttributes(PyObject *self, PyObject *args)
+{
+	PyObject* pyds;
+	const char* query;
+	PyObject* caseio;
+	bool casei;
+	const char* recordType;
+	PyObject* attributes;
+    if (!PyArg_ParseTuple(args, "OsOsO", &pyds, &query, &caseio, &recordType, &attributes) ||
+    	!PyCObject_Check(pyds) || !PyBool_Check(caseio) || !PyList_Check(attributes))
+    {
+		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: could not parse arguments", 0));		
+        return NULL;
+    }
+
+	casei = (caseio == Py_True);
+
+	// Convert list to CFArray of CFString
+	CFArrayRef cfattributes = PyListToCFArray(attributes);
+	if (cfattributes == NULL)
+    {
+		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: could not parse attributes list", 0));		
+        return NULL;
+    }
+
+	CDirectoryService* ds = static_cast<CDirectoryService*>(PyCObject_AsVoidPtr(pyds));
+	if (ds != NULL)
+	{
+		CFMutableArrayRef list = ds->QueryRecordsWithAttributes(query, casei, recordType, cfattributes);
+		if (list != NULL)
+		{
+			PyObject* result = CFArrayArrayDictionaryToPyDict(list);
+			CFRelease(list);
+			CFRelease(cfattributes);
+			
+			return result;
+		}
+	}
+	else
+		PyErr_SetObject(ODException_class, Py_BuildValue("((s:i))", "DirectoryServices queryRecordsWithAttributes: invalid directory service argument", 0));		
+	
+	CFRelease(cfattributes);
+	return NULL;
+}
+
+/*
+def listAllRecordsWithAttributes_list(obj, recordType, attributes):
+    """
+    List records in Open Directory, and return key attributes for each one.
+    
+    @param obj: C{object} the object obtained from an odInit call.
+    @param recordType: C{str} containing the OD record type to lookup.
+    @param attributes: C{list} containing the attributes to return for each record.
     @return: C{list} containing a C{list} of C{str} (record name) and C{dict} attributes 
          for each record found, or C{None} otherwise.
     """
  */
-extern "C" PyObject *listAllRecordsWithAttributes(PyObject *self, PyObject *args)
+extern "C" PyObject *listAllRecordsWithAttributes_list(PyObject *self, PyObject *args)
 {
 	PyObject* pyds;
 	const char* recordType;
@@ -274,7 +481,7 @@
 }
 
 /*
-def queryRecordsWithAttribute(obj, attr, value, matchType, casei, recordType, attributes):
+def queryRecordsWithAttribute_list(obj, attr, value, matchType, casei, recordType, attributes):
     """
     List records in Open Directory matching specified attribute and value, and return key attributes for each one.
     
@@ -289,7 +496,7 @@
          for each record found, or C{None} otherwise.
     """
  */
-extern "C" PyObject *queryRecordsWithAttribute(PyObject *self, PyObject *args)
+extern "C" PyObject *queryRecordsWithAttribute_list(PyObject *self, PyObject *args)
 {
 	PyObject* pyds;
 	const char* attr;
@@ -337,7 +544,7 @@
 }
 
 /*
-def queryRecordsWithAttributes(obj, query, casei, recordType, attributes):
+def queryRecordsWithAttributes_list(obj, query, casei, recordType, attributes):
     """
     List records in Open Directory matching specified compound query, and return key attributes for each one.
     
@@ -350,7 +557,7 @@
          for each record found, or C{None} otherwise.
     """
  */
-extern "C" PyObject *queryRecordsWithAttributes(PyObject *self, PyObject *args)
+extern "C" PyObject *queryRecordsWithAttributes_list(PyObject *self, PyObject *args)
 {
 	PyObject* pyds;
 	const char* query;
@@ -492,6 +699,12 @@
 		"List records in Open Directory matching specified attribute/value, and return key attributes for each one."},
     {"queryRecordsWithAttributes",  queryRecordsWithAttributes, METH_VARARGS,
 		"List records in Open Directory matching specified criteria, and return key attributes for each one."},
+    {"listAllRecordsWithAttributes_list",  listAllRecordsWithAttributes_list, METH_VARARGS,
+		"List all records of the specified type in Open Directory, returning requested attributes."},
+    {"queryRecordsWithAttribute_list",  queryRecordsWithAttribute_list, METH_VARARGS,
+		"List records in Open Directory matching specified attribute/value, and return key attributes for each one."},
+    {"queryRecordsWithAttributes_list",  queryRecordsWithAttributes_list, METH_VARARGS,
+		"List records in Open Directory matching specified criteria, and return key attributes for each one."},
     {"authenticateUserBasic",  authenticateUserBasic, METH_VARARGS,
 		"Authenticate a user with a password to Open Directory using plain text authentication."},
     {"authenticateUserDigest",  authenticateUserDigest, METH_VARARGS,

Modified: PyOpenDirectory/branches/users/cdaboo/multiple-computer-records-1917/test.py
===================================================================
--- PyOpenDirectory/branches/users/cdaboo/multiple-computer-records-1917/test.py	2007-09-27 19:22:04 UTC (rev 1920)
+++ PyOpenDirectory/branches/users/cdaboo/multiple-computer-records-1917/test.py	2007-09-27 21:20:05 UTC (rev 1921)
@@ -34,38 +34,159 @@
 		if d is None:
 			print "Failed to list users"
 		else:
+			names = [v for v in d.iterkeys()]
+			names.sort()
+			print "\nlistUsers number of results = %d" % (len(names),)
+			for n in names:
+				print "Name: %s" % n
+				print "dict: %s" % str(d[n])
+	
+	def listGroups():
+		d = opendirectory.listAllRecordsWithAttributes(ref, dsattributes.kDSStdRecordTypeGroups,
+													   [dsattributes.kDS1AttrGeneratedUID, dsattributes.kDSNAttrGroupMembers,])
+		if d is None:
+			print "Failed to list groups"
+		else:
+			names = [v for v in d.iterkeys()]
+			names.sort()
+			print "\nlistGroups number of results = %d" % (len(names),)
+			for n in names:
+				print "Name: %s" % n
+				print "dict: %s" % str(d[n])
+	
+	def listComputers():
+		d = opendirectory.listAllRecordsWithAttributes(ref, dsattributes.kDSStdRecordTypeComputers,
+													   [dsattributes.kDS1AttrGeneratedUID, dsattributes.kDS1AttrXMLPlist,])
+		if d is None:
+			print "Failed to list computers"
+		else:
+			names = [v for v in d.iterkeys()]
+			names.sort()
+			print "\nlistComputers number of results = %d" % (len(names),)
+			for n in names:
+				print "Name: %s" % n
+				print "dict: %s" % str(d[n])
+	
+	def querySimple(title, attr, value, matchType, casei, recordType, attrs):
+		d = opendirectory.queryRecordsWithAttribute(
+		    ref,
+		    attr,
+		    value,
+		    matchType,
+		    casei,
+			recordType,
+			attrs
+		)
+		if d is None:
+			print "Failed to query users"
+		else:
+			names = [v for v in d.iterkeys()]
+			names.sort()
+			print "\n%s number of results = %d" % (title, len(names),)
+			for n in names:
+				print "Name: %s" % n
+				print "dict: %s" % str(d[n])
+		
+	def queryCompound(title, compound, casei, recordType, attrs):
+		d = opendirectory.queryRecordsWithAttributes(
+		    ref,
+		    compound,
+		    casei,
+			recordType,
+			attrs
+		)
+		if d is None:
+			print "Failed to query users"
+		else:
+			names = [v for v in d.iterkeys()]
+			names.sort()
+			print "\n%s number of results = %d" % (title, len(names),)
+			for n in names:
+				print "Name: %s" % n
+				print "dict: %s" % str(d[n])
+		
+	def queryUsers():
+		querySimple(
+			"queryUsers",
+		    dsattributes.kDS1AttrFirstName,
+		    "cyrus",
+		    dsattributes.eDSExact,
+		    True,
+			dsattributes.kDSStdRecordTypeUsers,
+			[dsattributes.kDS1AttrGeneratedUID, dsattributes.kDS1AttrDistinguishedName,]
+		)
+		
+	def queryUsersCompoundOr():
+		queryCompound(
+			"queryUsersCompoundOr",
+		    expression(expression.OR,
+					   (match(dsattributes.kDS1AttrFirstName, "chris", dsattributes.eDSContains),
+					    match(dsattributes.kDS1AttrLastName, "roy", dsattributes.eDSContains))).generate(),
+		    False,
+			dsattributes.kDSStdRecordTypeUsers,
+			[dsattributes.kDS1AttrGeneratedUID, dsattributes.kDS1AttrDistinguishedName,]
+		)
+		
+	def queryUsersCompoundOrExact():
+		queryCompound(
+			"queryUsersCompoundOrExact",
+		    expression(expression.OR,
+					   (match(dsattributes.kDS1AttrFirstName, "chris", dsattributes.eDSExact),
+					    match(dsattributes.kDS1AttrLastName, "roy", dsattributes.eDSExact))).generate(),
+		    False,
+			dsattributes.kDSStdRecordTypeUsers,
+			[dsattributes.kDS1AttrGeneratedUID, dsattributes.kDS1AttrDistinguishedName,]
+		)
+		
+	def queryUsersCompoundAnd():
+		queryCompound(
+			"queryUsersCompoundAnd",
+		    expression(expression.AND,
+					   (match(dsattributes.kDS1AttrFirstName, "chris", dsattributes.eDSContains),
+					    match(dsattributes.kDS1AttrLastName, "roy", dsattributes.eDSContains))).generate(),
+		    True,
+			dsattributes.kDSStdRecordTypeUsers,
+			[dsattributes.kDS1AttrGeneratedUID, dsattributes.kDS1AttrDistinguishedName,]
+		)
+		
+	def listUsers_list():
+		d = opendirectory.listAllRecordsWithAttributes_list(ref, dsattributes.kDSStdRecordTypeUsers,
+													   [dsattributes.kDS1AttrGeneratedUID, dsattributes.kDS1AttrDistinguishedName,])
+		if d is None:
+			print "Failed to list users"
+		else:
 			d.sort(cmp=lambda x, y: x[0] < y[0])
-			print "\nlistUsers number of results = %d" % (len(d),)
+			print "\nlistUsers_list number of results = %d" % (len(d),)
 			for name, record in d:
 				print "Name: %s" % name
 				print "dict: %s" % str(record)
 	
-	def listGroups():
-		d = opendirectory.listAllRecordsWithAttributes(ref, dsattributes.kDSStdRecordTypeGroups,
+	def listGroups_list():
+		d = opendirectory.listAllRecordsWithAttributes_list(ref, dsattributes.kDSStdRecordTypeGroups,
 													   [dsattributes.kDS1AttrGeneratedUID, dsattributes.kDSNAttrGroupMembers,])
 		if d is None:
 			print "Failed to list groups"
 		else:
 			d.sort(cmp=lambda x, y: x[0] < y[0])
-			print "\nlistGroups number of results = %d" % (len(d),)
+			print "\nlistGroups_list number of results = %d" % (len(d),)
 			for name, record in d:
 				print "Name: %s" % name
 				print "dict: %s" % str(record)
 	
-	def listComputers():
-		d = opendirectory.listAllRecordsWithAttributes(ref, dsattributes.kDSStdRecordTypeComputers,
+	def listComputers_list():
+		d = opendirectory.listAllRecordsWithAttributes_list(ref, dsattributes.kDSStdRecordTypeComputers,
 													   [dsattributes.kDS1AttrGeneratedUID, dsattributes.kDS1AttrXMLPlist,])
 		if d is None:
 			print "Failed to list computers"
 		else:
 			d.sort(cmp=lambda x, y: x[0] < y[0])
-			print "\nlistComputers number of results = %d" % (len(d),)
+			print "\nlistComputers_list number of results = %d" % (len(d),)
 			for name, record in d:
 				print "Name: %s" % name
 				print "dict: %s" % str(record)
 	
-	def querySimple(title, attr, value, matchType, casei, recordType, attrs):
-		d = opendirectory.queryRecordsWithAttribute(
+	def querySimple_list(title, attr, value, matchType, casei, recordType, attrs):
+		d = opendirectory.queryRecordsWithAttribute_list(
 		    ref,
 		    attr,
 		    value,
@@ -83,8 +204,8 @@
 				print "Name: %s" % name
 				print "dict: %s" % str(record)
 		
-	def queryCompound(title, compound, casei, recordType, attrs):
-		d = opendirectory.queryRecordsWithAttributes(
+	def queryCompound_list(title, compound, casei, recordType, attrs):
+		d = opendirectory.queryRecordsWithAttributes_list(
 		    ref,
 		    compound,
 		    casei,
@@ -100,9 +221,9 @@
 				print "Name: %s" % name
 				print "dict: %s" % str(record)
 		
-	def queryUsers():
-		querySimple(
-			"queryUsers",
+	def queryUsers_list():
+		querySimple_list(
+			"queryUsers_list",
 		    dsattributes.kDS1AttrFirstName,
 		    "cyrus",
 		    dsattributes.eDSExact,
@@ -111,9 +232,9 @@
 			[dsattributes.kDS1AttrGeneratedUID, dsattributes.kDS1AttrDistinguishedName,]
 		)
 		
-	def queryUsersCompoundOr():
-		queryCompound(
-			"queryUsersCompoundOr",
+	def queryUsersCompoundOr_list():
+		queryCompound_list(
+			"queryUsersCompoundOr_list",
 		    expression(expression.OR,
 					   (match(dsattributes.kDS1AttrFirstName, "chris", dsattributes.eDSContains),
 					    match(dsattributes.kDS1AttrLastName, "roy", dsattributes.eDSContains))).generate(),
@@ -122,9 +243,9 @@
 			[dsattributes.kDS1AttrGeneratedUID, dsattributes.kDS1AttrDistinguishedName,]
 		)
 		
-	def queryUsersCompoundOrExact():
-		queryCompound(
-			"queryUsersCompoundOrExact",
+	def queryUsersCompoundOrExact_list():
+		queryCompound_list(
+			"queryUsersCompoundOrExact_list",
 		    expression(expression.OR,
 					   (match(dsattributes.kDS1AttrFirstName, "chris", dsattributes.eDSExact),
 					    match(dsattributes.kDS1AttrLastName, "roy", dsattributes.eDSExact))).generate(),
@@ -133,9 +254,9 @@
 			[dsattributes.kDS1AttrGeneratedUID, dsattributes.kDS1AttrDistinguishedName,]
 		)
 		
-	def queryUsersCompoundAnd():
-		queryCompound(
-			"queryUsersCompoundAnd",
+	def queryUsersCompoundAnd_list():
+		queryCompound_list(
+			"queryUsersCompoundAnd_list",
 		    expression(expression.AND,
 					   (match(dsattributes.kDS1AttrFirstName, "chris", dsattributes.eDSContains),
 					    match(dsattributes.kDS1AttrLastName, "roy", dsattributes.eDSContains))).generate(),
@@ -157,10 +278,19 @@
 	queryUsersCompoundOr()
 	queryUsersCompoundOrExact()
 	queryUsersCompoundAnd()
+	listUsers_list()
+	listGroups_list()
+	listComputers_list()
+	queryUsers_list()
+	queryUsersCompoundOr_list()
+	queryUsersCompoundOrExact_list()
+	queryUsersCompoundAnd_list()
 	#authentciateBasic()
 
 	ref = None
 except opendirectory.ODError, ex:
 	print ex
+except Exception, e:
+	print e
 
 print "Done."

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


More information about the calendarserver-changes mailing list