[CalendarServer-changes] [9726] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Fri Aug 17 11:01:52 PDT 2012
Revision: 9726
http://trac.macosforge.org/projects/calendarserver/changeset/9726
Author: sagen at apple.com
Date: 2012-08-17 11:01:51 -0700 (Fri, 17 Aug 2012)
Log Message:
-----------
calendar-user-search becomes calendarserver-principal-search and is now advertised everywhere under supported-report-set (and OPTIONS)
Modified Paths:
--------------
CalendarServer/trunk/twext/web2/dav/resource.py
CalendarServer/trunk/twistedcaldav/customxml.py
CalendarServer/trunk/twistedcaldav/directory/directory.py
CalendarServer/trunk/twistedcaldav/directory/principal.py
CalendarServer/trunk/twistedcaldav/extensions.py
CalendarServer/trunk/twistedcaldav/stdconfig.py
CalendarServer/trunk/twistedcaldav/test/test_extensions.py
Modified: CalendarServer/trunk/twext/web2/dav/resource.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/resource.py 2012-08-17 17:50:52 UTC (rev 9725)
+++ CalendarServer/trunk/twext/web2/dav/resource.py 2012-08-17 18:01:51 UTC (rev 9726)
@@ -76,6 +76,7 @@
from twext.web2.dav.noneprops import NonePropertyStore
from twext.web2.dav.util import unimplemented, parentForURL, joinURL
from twext.web2.dav.auth import PrincipalCredentials
+from twistedcaldav import customxml
log = Logger()
@@ -887,6 +888,7 @@
result.append(element.Report(element.PrincipalMatch(),))
result.append(element.Report(element.PrincipalPropertySearch(),))
result.append(element.Report(element.ExpandProperty(),))
+ result.append(element.Report(customxml.CalendarServerPrincipalSearch(),))
return result
##
Modified: CalendarServer/trunk/twistedcaldav/customxml.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/customxml.py 2012-08-17 17:50:52 UTC (rev 9725)
+++ CalendarServer/trunk/twistedcaldav/customxml.py 2012-08-17 18:01:51 UTC (rev 9726)
@@ -54,6 +54,11 @@
"calendarserver-principal-property-search",
)
+calendarserver_principal_search_compliance = (
+ "calendarserver-principal-search",
+)
+
+
calendarserver_sharing_compliance = (
"calendarserver-sharing",
)
@@ -1350,11 +1355,11 @@
name = "calendar-color"
#
-# Calendar-user-search REPORT
+# calendarserver-principal-search REPORT
#
@registerElement
-class CalendarUserSearchToken (WebDAVTextElement):
+class CalendarServerPrincipalSearchToken (WebDAVTextElement):
"""
Contains a search token.
"""
@@ -1362,15 +1367,15 @@
name = "search-token"
@registerElement
-class CalendarUserSearch (WebDAVElement):
+class CalendarServerPrincipalSearch (WebDAVElement):
namespace = calendarserver_namespace
- name = "calendar-user-search"
+ name = "calendarserver-principal-search"
allowed_children = {
- (calendarserver_namespace, "search-token" ): (1, None),
+ (calendarserver_namespace, "search-token" ): (0, None),
(calendarserver_namespace, "limit" ): (0, 1),
- (dav_namespace, "prop" ): (1, 1),
+ (dav_namespace, "prop" ): (0, 1),
(dav_namespace, "apply-to-principal-collection-set"): (0, 1),
}
allowed_attributes = { "context" : False }
Modified: CalendarServer/trunk/twistedcaldav/directory/directory.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/directory.py 2012-08-17 17:50:52 UTC (rev 9725)
+++ CalendarServer/trunk/twistedcaldav/directory/directory.py 2012-08-17 18:01:51 UTC (rev 9726)
@@ -242,7 +242,7 @@
def recordTypesForSearchContext(self, context):
"""
- Map calendar-user-search REPORT context value to applicable record types
+ Map calendarserver-principal-search REPORT context value to applicable record types
@param context: The context value to map (either "location" or "attendee")
@type context: C{str}
Modified: CalendarServer/trunk/twistedcaldav/directory/principal.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/principal.py 2012-08-17 17:50:52 UTC (rev 9725)
+++ CalendarServer/trunk/twistedcaldav/directory/principal.py 2012-08-17 18:01:51 UTC (rev 9726)
@@ -56,7 +56,7 @@
from twistedcaldav import caldavxml, customxml
from twistedcaldav.cache import DisabledCacheNotifier, PropfindCacheMixin
from twistedcaldav.config import config
-from twistedcaldav.customxml import calendarserver_namespace, CalendarUserSearch
+from twistedcaldav.customxml import calendarserver_namespace, CalendarServerPrincipalSearch
from twistedcaldav.directory.augment import allowedAutoScheduleModes
from twistedcaldav.directory.common import uidsResourceName
from twistedcaldav.directory.directory import DirectoryService, DirectoryRecord
@@ -364,15 +364,6 @@
return (self,)
- def supportedReports(self):
- """
- Adds the CalendarUserSearch REPORT
- """
- result = super(DirectoryPrincipalProvisioningResource, self).supportedReports()
- result.append(davxml.Report(CalendarUserSearch(),))
- return result
-
-
class DirectoryPrincipalTypeProvisioningResource (DirectoryProvisioningResource):
"""
Collection resource which provisions directory principals of a
Modified: CalendarServer/trunk/twistedcaldav/extensions.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/extensions.py 2012-08-17 17:50:52 UTC (rev 9725)
+++ CalendarServer/trunk/twistedcaldav/extensions.py 2012-08-17 18:01:51 UTC (rev 9726)
@@ -250,28 +250,28 @@
@inlineCallbacks
- def report_http___calendarserver_org_ns__calendar_user_search(self, request,
- calendar_user_search):
+ def report_http___calendarserver_org_ns__calendarserver_principal_search(self, request,
+ calendarserver_principal_search):
"""
- Generate a calendar-user-search REPORT.
+ Generate a calendarserver-principal-search REPORT.
@param request: Request object
- @param calendar_user_search: CalendarUserSearch object
+ @param calendarserver_principal_search: CalendarServerPrincipalSearch object
"""
# Verify root element
- if not isinstance(calendar_user_search, customxml.CalendarUserSearch):
- msg = "%s expected as root element, not %s." % (customxml.CalendarUserSearch.sname(), calendar_user_search.sname())
+ if not isinstance(calendarserver_principal_search, customxml.CalendarServerPrincipalSearch):
+ msg = "%s expected as root element, not %s." % (customxml.CalendarServerPrincipalSearch.sname(), calendarserver_principal_search.sname())
log.warn(msg)
raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, msg))
# Only handle Depth: 0
depth = request.headers.getHeader("depth", "0")
if depth != "0":
- log.err("Error in calendar-user-search REPORT, Depth set to %s" % (depth,))
+ log.err("Error in calendarserver-principal-search REPORT, Depth set to %s" % (depth,))
raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, "Depth %s not allowed" % (depth,)))
- tokens, context, applyTo, clientLimit, propElement = extractCalendarUserSearchData(calendar_user_search)
+ tokens, context, applyTo, clientLimit, propElement = extractCalendarServerPrincipalSearchData(calendarserver_principal_search)
# Run report
resultsWereLimited = None
@@ -324,7 +324,7 @@
if resultsWereLimited is not None:
if resultsWereLimited[0] == "server":
log.err("Too many matching resources in "
- "calendar-user-search report")
+ "calendarserver-principal-search report")
responses.append(element.StatusResponse(
element.HRef.fromString(request.uri),
element.Status.fromResponseCode(
@@ -963,11 +963,11 @@
)
return self._data
-def extractCalendarUserSearchData(doc):
+def extractCalendarServerPrincipalSearchData(doc):
"""
- Extract relevant info from a CalendarUserSearch document
+ Extract relevant info from a CalendarServerPrincipalSearch document
- @param doc: CalendarUserSearch object to extract info from
+ @param doc: CalendarServerPrincipalSearch object to extract info from
@return: A tuple containing:
the list of tokens
the context string
Modified: CalendarServer/trunk/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/stdconfig.py 2012-08-17 17:50:52 UTC (rev 9725)
+++ CalendarServer/trunk/twistedcaldav/stdconfig.py 2012-08-17 18:01:51 UTC (rev 9726)
@@ -1470,6 +1470,7 @@
# Principal property search is always enabled
compliance += customxml.calendarserver_principal_property_search_compliance
+ compliance += customxml.calendarserver_principal_search_compliance
configDict.CalDAVComplianceClasses = compliance
Modified: CalendarServer/trunk/twistedcaldav/test/test_extensions.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_extensions.py 2012-08-17 17:50:52 UTC (rev 9725)
+++ CalendarServer/trunk/twistedcaldav/test/test_extensions.py 2012-08-17 18:01:51 UTC (rev 9726)
@@ -25,7 +25,7 @@
from twisted.trial.unittest import TestCase
from twisted.web.microdom import parseString
-from twistedcaldav.extensions import DAVFile, DAVResourceWithChildrenMixin, extractCalendarUserSearchData
+from twistedcaldav.extensions import DAVFile, DAVResourceWithChildrenMixin, extractCalendarServerPrincipalSearchData
from xml.etree.cElementTree import XML
@@ -222,29 +222,29 @@
self.assertEquals(result[1], ['burger'])
-class CalendarUserSearchTests(TestCase):
- def test_extractCalendarUserSearchData(self):
+class CalendarServerPrincipalSearchTests(TestCase):
+ def test_extractCalendarServerPrincipalSearchData(self):
"""
- Exercise the parser for calendar-user-search documents
+ Exercise the parser for calendarserver-principal-search documents
"""
- data = """<B:calendar-user-search xmlns:A="DAV:" xmlns:B="http://calendarserver.org/ns/" context="attendee">
+ data = """<B:calendarserver-principal-search xmlns:A="DAV:" xmlns:B="http://calendarserver.org/ns/" context="attendee">
<B:search-token>morgen</B:search-token>
<A:prop>
<A:principal-URL/>
<A:displayname/>
</A:prop>
-</B:calendar-user-search>
+</B:calendarserver-principal-search>
"""
doc = WebDAVDocument.fromString(data)
- tokens, context, applyTo, clientLimit, propElement = extractCalendarUserSearchData(doc.root_element)
+ tokens, context, applyTo, clientLimit, propElement = extractCalendarServerPrincipalSearchData(doc.root_element)
self.assertEquals(tokens, ["morgen"])
self.assertEquals(context, "attendee")
self.assertFalse(applyTo)
self.assertEquals(clientLimit, None)
- data = """<B:calendar-user-search xmlns:A="DAV:" xmlns:B="http://calendarserver.org/ns/">
+ data = """<B:calendarserver-principal-search xmlns:A="DAV:" xmlns:B="http://calendarserver.org/ns/">
<B:search-token>morgen</B:search-token>
<B:search-token>sagen</B:search-token>
<B:limit>
@@ -255,10 +255,10 @@
<A:displayname/>
</A:prop>
<A:apply-to-principal-collection-set/>
-</B:calendar-user-search>
+</B:calendarserver-principal-search>
"""
doc = WebDAVDocument.fromString(data)
- tokens, context, applyTo, clientLimit, propElement = extractCalendarUserSearchData(doc.root_element)
+ tokens, context, applyTo, clientLimit, propElement = extractCalendarServerPrincipalSearchData(doc.root_element)
self.assertEquals(tokens, ["morgen", "sagen"])
self.assertEquals(context, None)
self.assertTrue(applyTo)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120817/b4fa6d9c/attachment-0001.html>
More information about the calendarserver-changes
mailing list