[CalendarServer-changes] [5503] CalendarServer/trunk/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Wed Apr 21 16:42:45 PDT 2010


Revision: 5503
          http://trac.macosforge.org/projects/calendarserver/changeset/5503
Author:   cdaboo at apple.com
Date:     2010-04-21 16:42:42 -0700 (Wed, 21 Apr 2010)
Log Message:
-----------
Fix directory gateway to operate with the new query objects.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/directory/opendirectorybacker.py
    CalendarServer/trunk/twistedcaldav/method/report_addressbook_multiget.py
    CalendarServer/trunk/twistedcaldav/method/report_addressbook_query.py

Modified: CalendarServer/trunk/twistedcaldav/directory/opendirectorybacker.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/opendirectorybacker.py	2010-04-21 17:25:53 UTC (rev 5502)
+++ CalendarServer/trunk/twistedcaldav/directory/opendirectorybacker.py	2010-04-21 23:42:42 UTC (rev 5503)
@@ -1,5 +1,5 @@
 ##
-# Copyright (c) 2006-2009 Apple Inc. All rights reserved.
+# Copyright (c) 2006-2010 Apple Inc. All rights reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -60,6 +60,7 @@
 from twistedcaldav.ical import iCalendarProductID
 from twistedcaldav.memcachelock import MemcacheLock, MemcacheLockTimeoutError
 from twistedcaldav.method.put_addressbook_common import StoreAddressObjectResource
+from twistedcaldav.query import addressbookqueryfilter
 from twistedcaldav.static import CalDAVFile
 from twistedcaldav.vcard import Component, Property
 
@@ -816,7 +817,7 @@
                         return( textMatchElement.match([constant,]), [], [] )
                     else:
 
-                        matchStrings = getMatchStrings(propFilter, str(textMatchElement))
+                        matchStrings = getMatchStrings(propFilter, textMatchElement.text)
 
                         if not len(matchStrings) or binaryAttrStrs:
                             # no searching text in binary ds attributes, so change to defined/not defined case
@@ -901,11 +902,11 @@
                 if not constant and not allAttrStrings: 
                     return (False, [], [])
                 
-                if propFilter.qualifier and isinstance(propFilter.qualifier, carddavxml.IsNotDefined):
+                if propFilter.qualifier and isinstance(propFilter.qualifier, addressbookqueryfilter.IsNotDefined):
                     return definedExpression(False, filterAllOf, propFilter.filter_name, constant, queryAttributes, allAttrStrings)
                 
-                paramFilterElements = [paramFilterElement for paramFilterElement in propFilter.filters if isinstance(paramFilterElement, carddavxml.ParameterFilter)]
-                textMatchElements = [textMatchElement for textMatchElement in propFilter.filters if isinstance(textMatchElement, carddavxml.TextMatch)]
+                paramFilterElements = [paramFilterElement for paramFilterElement in propFilter.filters if isinstance(paramFilterElement, addressbookqueryfilter.ParameterFilter)]
+                textMatchElements = [textMatchElement for textMatchElement in propFilter.filters if isinstance(textMatchElement, addressbookqueryfilter.TextMatch)]
                 propFilterAllOf = propFilter.propfilter_test == "allof"
                 
                 # handle parameter filter elements

Modified: CalendarServer/trunk/twistedcaldav/method/report_addressbook_multiget.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report_addressbook_multiget.py	2010-04-21 17:25:53 UTC (rev 5502)
+++ CalendarServer/trunk/twistedcaldav/method/report_addressbook_multiget.py	2010-04-21 23:42:42 UTC (rev 5503)
@@ -37,6 +37,7 @@
 from twistedcaldav.config import config
 from twistedcaldav.carddavxml import carddav_namespace
 from twistedcaldav.method import report_common
+from twistedcaldav.query import addressbookqueryfilter
 
 log = Logger()
 
@@ -156,6 +157,7 @@
                         returnValue( None )
                          
                     addressBookFilter = carddavxml.Filter( *vCardFilters )
+                    addressBookFilter = addressbookqueryfilter.Filter(addressBookFilter)
                     if self.directory.cacheQuery:
                         # add vcards to directory address book and run "normal case" below
                         limit = 0 #config.MaxAddressBookMultigetHrefs

Modified: CalendarServer/trunk/twistedcaldav/method/report_addressbook_query.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report_addressbook_query.py	2010-04-21 17:25:53 UTC (rev 5502)
+++ CalendarServer/trunk/twistedcaldav/method/report_addressbook_query.py	2010-04-21 23:42:42 UTC (rev 5503)
@@ -186,6 +186,7 @@
                                                         carddavxml.TextMatch.fromString(resource_name[:-4]), 
                                                         name="UID", # attributes
                                                         ),] )
+                            vCardFilter = addressbookqueryfilter.Filter(vCardFilter)
                             
                             directoryAddressBookLock, limited[0] = (yield  directory.cacheVCardsForAddressBookQuery( vCardFilter, query, max_number_of_results[0] ) )
 
@@ -255,6 +256,7 @@
                                                     carddavxml.TextMatch.fromString(resource_name[:-4]), 
                                                     name="UID", # attributes
                                                     ),] )
+                        vCardFilter = addressbookqueryfilter.Filter(vCardFilter)
                         
                         yield  maybeDeferred( queryDirectoryBackedAddressBook, parent, vCardFilter )
                         handled = True
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100421/49b5d924/attachment-0001.html>


More information about the calendarserver-changes mailing list