[CalendarServer-changes] [8909] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Sun Mar 18 01:21:48 PDT 2012
Revision: 8909
http://trac.macosforge.org/projects/calendarserver/changeset/8909
Author: wsanchez at apple.com
Date: 2012-03-18 01:21:46 -0700 (Sun, 18 Mar 2012)
Log Message:
-----------
More cleanup
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/directorybackedaddressbook.py
CalendarServer/trunk/twistedcaldav/schedule.py
CalendarServer/trunk/txdav/xml/__init__.py
CalendarServer/trunk/txdav/xml/extensions.py
CalendarServer/trunk/txdav/xml/rfc2518.py
Added Paths:
-----------
CalendarServer/trunk/txdav/xml/draft_sync.py
CalendarServer/trunk/txdav/xml/rfc5397.py
CalendarServer/trunk/txdav/xml/rfc5995.py
Modified: CalendarServer/trunk/twistedcaldav/directorybackedaddressbook.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directorybackedaddressbook.py 2012-03-18 06:48:27 UTC (rev 8908)
+++ CalendarServer/trunk/twistedcaldav/directorybackedaddressbook.py 2012-03-18 08:21:46 UTC (rev 8909)
@@ -25,7 +25,6 @@
from twext.python.log import Logger
from twext.web2 import responsecode
from txdav.xml import element as davxml
-from txdav.xml.extensions import SyncCollection
from twext.web2.dav.resource import TwistedACLInheritable
from twext.web2.http import HTTPError, StatusResponse
@@ -125,7 +124,7 @@
result = super(DirectoryBackedAddressBookResource, self).supportedReports()
if config.EnableSyncReport:
# Not supported on the directory backed address book
- result.remove(davxml.Report(SyncCollection(),))
+ result.remove(davxml.Report(davxml.SyncCollection(),))
return result
def resourceType(self):
Modified: CalendarServer/trunk/twistedcaldav/schedule.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/schedule.py 2012-03-18 06:48:27 UTC (rev 8908)
+++ CalendarServer/trunk/twistedcaldav/schedule.py 2012-03-18 08:21:46 UTC (rev 8909)
@@ -28,7 +28,6 @@
from twext.web2 import responsecode
from txdav.xml import element as davxml
-from txdav.xml.extensions import SyncCollection
from txdav.xml.rfc2518 import HRef
from twext.web2.dav.http import ErrorResponse, MultiStatusResponse
from twext.web2.dav.noneprops import NonePropertyStore
@@ -123,7 +122,7 @@
# free-busy report not allowed
if config.EnableSyncReport:
# Only allowed on calendar/inbox/addressbook collections
- result.append(davxml.Report(SyncCollection(),))
+ result.append(davxml.Report(davxml.SyncCollection(),))
return result
class ScheduleInboxResource (CalendarSchedulingCollectionResource):
Modified: CalendarServer/trunk/txdav/xml/__init__.py
===================================================================
--- CalendarServer/trunk/txdav/xml/__init__.py 2012-03-18 06:48:27 UTC (rev 8908)
+++ CalendarServer/trunk/txdav/xml/__init__.py 2012-03-18 08:21:46 UTC (rev 8909)
@@ -46,7 +46,9 @@
import txdav.xml.rfc3744
import txdav.xml.rfc4331
import txdav.xml.rfc5842
+import txdav.xml.rfc5397
+import txdav.xml.rfc5995
+import txdav.xml.draft_sync
import txdav.xml.extensions
txdav # Shhh pyflakes
-
Added: CalendarServer/trunk/txdav/xml/draft_sync.py
===================================================================
--- CalendarServer/trunk/txdav/xml/draft_sync.py (rev 0)
+++ CalendarServer/trunk/txdav/xml/draft_sync.py 2012-03-18 08:21:46 UTC (rev 8909)
@@ -0,0 +1,100 @@
+##
+# Copyright (c) 2009-2012 Apple Computer, Inc. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+##
+
+"""
+draft-daboo-webdav-sync (Collection Synchronization for WebDAV) XML
+Elements
+
+This module provides XML element definitions for use with WebDAV
+Synchronization.
+
+See draft-daboo-webdav-sync: http://tools.ietf.org/html/draft-daboo-webdav-sync
+
+Last draft referenced: -08
+"""
+
+from txdav.xml.base import WebDAVElement, WebDAVTextElement, dav_namespace
+from txdav.xml.element import registerElement, registerElementClass
+from txdav.xml.rfc2518 import MultiStatus
+
+
+ at registerElement
+ at registerElementClass
+class SyncCollection (WebDAVElement):
+ """
+ DAV report used to retrieve specific calendar component items via
+ their URIs.
+ """
+ name = "sync-collection"
+
+ # To allow for an empty element in a supported-report-set property we need
+ # to relax the child restrictions
+ allowed_children = {
+ (dav_namespace, "sync-token"): (0, 1), # When used in the REPORT this is required
+ (dav_namespace, "sync-level"): (0, 1), # When used in the REPORT this is required
+ (dav_namespace, "prop" ): (0, 1),
+ }
+
+ def __init__(self, *children, **attributes):
+ super(SyncCollection, self).__init__(*children, **attributes)
+
+ self.property = None
+ self.sync_token = None
+ self.sync_level = None
+
+ for child in self.children:
+ qname = child.qname()
+
+ if qname == (dav_namespace, "sync-token"):
+ self.sync_token = str(child)
+
+ elif qname == (dav_namespace, "sync-level"):
+ self.sync_level = str(child)
+
+ elif qname == (dav_namespace, "prop"):
+ if self.property is not None:
+ raise ValueError("Only one of DAV:prop allowed")
+ self.property = child
+
+
+ at registerElement
+ at registerElementClass
+class SyncToken (WebDAVTextElement):
+ """
+ Synchronization token used in report and as a property.
+ """
+ name = "sync-token"
+ hidden = True
+ protected = True
+
+
+ at registerElement
+ at registerElementClass
+class SyncLevel (WebDAVTextElement):
+ """
+ Synchronization level used in report.
+ """
+ name = "sync-level"
+
+
+# Extend MultiStatus, to add sync-token
+MultiStatus.allowed_children[(dav_namespace, "sync-token")] = (0, 1)
Modified: CalendarServer/trunk/txdav/xml/extensions.py
===================================================================
--- CalendarServer/trunk/txdav/xml/extensions.py 2012-03-18 06:48:27 UTC (rev 8908)
+++ CalendarServer/trunk/txdav/xml/extensions.py 2012-03-18 08:21:46 UTC (rev 8909)
@@ -28,36 +28,12 @@
Implementation of draft-sanchez-webdav-current-principal-02.
"""
-__all__ = [
- "CurrentUserPrincipal",
- "ErrorDescription",
- "AddMember",
- "SyncCollection",
- "SyncToken",
- "SyncLevel",
-]
-
-from txdav.xml.base import WebDAVElement, WebDAVTextElement
-from txdav.xml.element import dav_namespace, twisted_dav_namespace
+from txdav.xml.base import WebDAVTextElement, twisted_dav_namespace
from txdav.xml.element import registerElement, registerElementClass
@registerElement
@registerElementClass
-class CurrentUserPrincipal(WebDAVElement):
- """
- Current principal information
- """
- name = "current-user-principal"
-
- allowed_children = {
- (dav_namespace, "href" ) : (0, 1),
- (dav_namespace, "unauthenticated" ) : (0, 1),
- }
-
-
- at registerElement
- at registerElementClass
class ErrorDescription(WebDAVTextElement):
"""
The human-readable description of a failed precondition
@@ -65,77 +41,3 @@
namespace = twisted_dav_namespace
name = "error-description"
protected = True
-
-
- at registerElement
- at registerElementClass
-class AddMember (WebDAVElement):
- """
- A property on a collection to allow for "anonymous" creation of resources.
- (draft-reschke-webdav-post)
- """
- name = "add-member"
- hidden = True
- protected = True
-
- allowed_children = { (dav_namespace, "href"): (0, 1) }
-
-
- at registerElement
- at registerElementClass
-class SyncCollection (WebDAVElement):
- """
- DAV report used to retrieve specific calendar component items via their
- URIs.
- (draft-daboo-webdav-sync)
- """
- name = "sync-collection"
-
- # To allow for an empty element in a supported-report-set property we need
- # to relax the child restrictions
- allowed_children = {
- (dav_namespace, "sync-token"): (0, 1), # When used in the REPORT this is required
- (dav_namespace, "sync-level"): (0, 1), # When used in the REPORT this is required
- (dav_namespace, "prop" ): (0, 1),
- }
-
- def __init__(self, *children, **attributes):
- super(SyncCollection, self).__init__(*children, **attributes)
-
- self.property = None
- self.sync_token = None
- self.sync_level = None
-
- for child in self.children:
- qname = child.qname()
-
- if qname == (dav_namespace, "sync-token"):
- self.sync_token = str(child)
-
- elif qname == (dav_namespace, "sync-level"):
- self.sync_level = str(child)
-
- elif qname == (dav_namespace, "prop"):
- if self.property is not None:
- raise ValueError("Only one of DAV:prop allowed")
- self.property = child
-
-
- at registerElement
- at registerElementClass
-class SyncToken (WebDAVTextElement):
- """
- Synchronization token used in report and as a property.
- """
- name = "sync-token"
- hidden = True
- protected = True
-
-
- at registerElement
- at registerElementClass
-class SyncLevel (WebDAVTextElement):
- """
- Synchronization level used in report.
- """
- name = "sync-level"
Modified: CalendarServer/trunk/txdav/xml/rfc2518.py
===================================================================
--- CalendarServer/trunk/txdav/xml/rfc2518.py 2012-03-18 06:48:27 UTC (rev 8908)
+++ CalendarServer/trunk/txdav/xml/rfc2518.py 2012-03-18 08:21:46 UTC (rev 8909)
@@ -20,6 +20,8 @@
# SOFTWARE.
##
+# FIXME: RFC 2518 is obsoleted by RFC 5689. Check for changes.
+
"""
RFC 2518 (WebDAV) XML Elements
@@ -711,7 +713,7 @@
allowed_children = { (dav_namespace, "lockentry"): (0, None) }
-# Pre-conditions codes defined in RFC4918
+# FIXME: Add preconditions codes defined in RFC4918
@registerElement
Added: CalendarServer/trunk/txdav/xml/rfc5397.py
===================================================================
--- CalendarServer/trunk/txdav/xml/rfc5397.py (rev 0)
+++ CalendarServer/trunk/txdav/xml/rfc5397.py 2012-03-18 08:21:46 UTC (rev 8909)
@@ -0,0 +1,47 @@
+##
+# Copyright (c) 2009-2012 Apple Computer, Inc. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+##
+
+"""
+RFC 5397 (WebDAV Current Principal Extension) XML Elements
+
+This module provides XML element definitions for use with the
+DAV:current-user-principal property.
+
+See RFC 5397: http://www.ietf.org/rfc/rfc5397.txt
+"""
+
+from txdav.xml.base import WebDAVElement, dav_namespace
+from txdav.xml.element import registerElement, registerElementClass
+
+
+ at registerElement
+ at registerElementClass
+class CurrentUserPrincipal(WebDAVElement):
+ """
+ Current principal information
+ """
+ name = "current-user-principal"
+
+ allowed_children = {
+ (dav_namespace, "href") : (0, 1),
+ (dav_namespace, "unauthenticated") : (0, 1),
+ }
Added: CalendarServer/trunk/txdav/xml/rfc5995.py
===================================================================
--- CalendarServer/trunk/txdav/xml/rfc5995.py (rev 0)
+++ CalendarServer/trunk/txdav/xml/rfc5995.py 2012-03-18 08:21:46 UTC (rev 8909)
@@ -0,0 +1,58 @@
+##
+# Copyright (c) 2009-2012 Apple Computer, Inc. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+##
+
+"""
+RFC 5995 (Using POST to Add Members to WebDAV Collections) XML
+Elements
+
+This module provides XML element definitions for use with using POST
+to add members to WebDAV collections.
+
+See RFC 5995: http://www.ietf.org/rfc/rfc5995.txt
+"""
+
+from txdav.xml.base import WebDAVElement, dav_namespace
+from txdav.xml.element import registerElement, registerElementClass
+
+
+ at registerElement
+ at registerElementClass
+class AddMember (WebDAVElement):
+ """
+ A property on a collection to allow for "anonymous" creation of
+ resources.
+ """
+ name = "add-member"
+ hidden = True
+ protected = True
+
+ allowed_children = { (dav_namespace, "href"): (0, 1) }
+
+
+ at registerElement
+ at registerElementClass
+class AllowClientDefinedURI (WebDAVElement):
+ """
+ Precondition indicating that the server allows clients to specify
+ the last path segment for newly created resources.
+ """
+ name = "allow-client-defined-uri"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120318/b3589a48/attachment-0001.html>
More information about the calendarserver-changes
mailing list