[CalendarServer-changes] [8880] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Thu Mar 15 18:12:29 PDT 2012
Revision: 8880
http://trac.macosforge.org/projects/calendarserver/changeset/8880
Author: wsanchez at apple.com
Date: 2012-03-15 18:12:29 -0700 (Thu, 15 Mar 2012)
Log Message:
-----------
Clean up twext.web2.dav.element and move it to txdav.xml.
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/webadmin/test/test_resource.py
CalendarServer/trunk/twext/web2/dav/davxml.py
CalendarServer/trunk/twext/web2/dav/http.py
CalendarServer/trunk/twext/web2/dav/method/prop_common.py
CalendarServer/trunk/twext/web2/dav/method/put_common.py
CalendarServer/trunk/twext/web2/dav/method/report.py
CalendarServer/trunk/twext/web2/dav/resource.py
CalendarServer/trunk/twistedcaldav/customxml.py
CalendarServer/trunk/twistedcaldav/directory/calendaruserproxy.py
CalendarServer/trunk/twistedcaldav/directory/opendirectorybacker.py
CalendarServer/trunk/twistedcaldav/directorybackedaddressbook.py
CalendarServer/trunk/twistedcaldav/method/report.py
CalendarServer/trunk/twistedcaldav/method/report_common.py
CalendarServer/trunk/twistedcaldav/method/report_multiget_common.py
CalendarServer/trunk/twistedcaldav/method/report_sync_collection.py
CalendarServer/trunk/twistedcaldav/schedule.py
CalendarServer/trunk/twistedcaldav/storebridge.py
CalendarServer/trunk/twistedcaldav/test/test_extensions.py
CalendarServer/trunk/twistedcaldav/test/test_resource.py
CalendarServer/trunk/txdav/base/datastore/file.py
CalendarServer/trunk/txdav/base/propertystore/test/test_appledouble.py
CalendarServer/trunk/txdav/base/propertystore/test/test_xattr.py
CalendarServer/trunk/txdav/caldav/datastore/file.py
CalendarServer/trunk/txdav/caldav/datastore/sql.py
CalendarServer/trunk/txdav/caldav/datastore/test/common.py
CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py
CalendarServer/trunk/txdav/caldav/resource.py
CalendarServer/trunk/txdav/carddav/datastore/file.py
CalendarServer/trunk/txdav/carddav/datastore/sql.py
CalendarServer/trunk/txdav/carddav/datastore/test/common.py
CalendarServer/trunk/txdav/carddav/datastore/test/test_sql.py
CalendarServer/trunk/txdav/carddav/resource.py
CalendarServer/trunk/txdav/common/datastore/file.py
CalendarServer/trunk/txdav/common/datastore/sql.py
CalendarServer/trunk/txdav/common/datastore/upgrade/sql/upgrades/upgrade_from_1_to_2.py
CalendarServer/trunk/txdav/common/inotifications.py
CalendarServer/trunk/txdav/xml/__init__.py
CalendarServer/trunk/txdav/xml/base.py
CalendarServer/trunk/txdav/xml/extensions.py
CalendarServer/trunk/txdav/xml/parser.py
CalendarServer/trunk/txdav/xml/rfc2518.py
CalendarServer/trunk/txdav/xml/rfc3253.py
CalendarServer/trunk/txdav/xml/rfc3744.py
CalendarServer/trunk/txdav/xml/rfc4331.py
CalendarServer/trunk/txdav/xml/rfc5842.py
CalendarServer/trunk/txdav/xml/util.py
Added Paths:
-----------
CalendarServer/trunk/txdav/xml/
Removed Paths:
-------------
CalendarServer/trunk/twext/web2/dav/element/
Modified: CalendarServer/trunk/calendarserver/webadmin/test/test_resource.py
===================================================================
--- CalendarServer/trunk/calendarserver/webadmin/test/test_resource.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/calendarserver/webadmin/test/test_resource.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -33,12 +33,12 @@
from twisted.internet.defer import returnValue
from calendarserver.webadmin.resource import WebAdminResource
-from twext.web2.dav.element.rfc3744 import GroupMemberSet
-from twext.web2.dav.element.rfc2518 import DisplayName
+from txdav.xml.rfc3744 import GroupMemberSet
+from txdav.xml.rfc2518 import DisplayName
from twext.web2.http import HTTPError
from twext.web2.responsecode import CONFLICT
-from twext.web2.dav.element.rfc2518 import HRef
+from txdav.xml.rfc2518 import HRef
from twistedcaldav.directory.directory import DirectoryRecord
Modified: CalendarServer/trunk/twext/web2/dav/davxml.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/davxml.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/twext/web2/dav/davxml.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -40,29 +40,29 @@
# Import all XML element definitions
#
-from twext.web2.dav.element.base import *
-from twext.web2.dav.element.parser import *
-from twext.web2.dav.element.util import *
-from twext.web2.dav.element.rfc2518 import *
-from twext.web2.dav.element.rfc3253 import *
-from twext.web2.dav.element.rfc3744 import *
-from twext.web2.dav.element.rfc4331 import *
-from twext.web2.dav.element.rfc5842 import *
-from twext.web2.dav.element.extensions import *
+from txdav.xml.base import *
+from txdav.xml.parser import *
+from txdav.xml.util import *
+from txdav.xml.rfc2518 import *
+from txdav.xml.rfc3253 import *
+from txdav.xml.rfc3744 import *
+from txdav.xml.rfc4331 import *
+from txdav.xml.rfc5842 import *
+from txdav.xml.extensions import *
#
# Register all XML elements with the parser
#
-from twext.web2.dav.element import base as b
-from twext.web2.dav.element import parser as p
-from twext.web2.dav.element import util as u
-from twext.web2.dav.element import rfc2518 as r1
-from twext.web2.dav.element import rfc3253 as r2
-from twext.web2.dav.element import rfc3744 as r3
-from twext.web2.dav.element import rfc4331 as r4
-from twext.web2.dav.element import rfc5842 as r5
-from twext.web2.dav.element import extensions as e
+from txdav.xml import base as b
+from txdav.xml import parser as p
+from txdav.xml import util as u
+from txdav.xml import rfc2518 as r1
+from txdav.xml import rfc3253 as r2
+from txdav.xml import rfc3744 as r3
+from txdav.xml import rfc4331 as r4
+from txdav.xml import rfc5842 as r5
+from txdav.xml import extensions as e
__all__ = (
registerElements(b) +
Modified: CalendarServer/trunk/twext/web2/dav/http.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/http.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/twext/web2/dav/http.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -237,7 +237,7 @@
if len(property.children) > 0:
# Re-instantiate as empty element.
- property = property.emptyCopy()
+ property = davxml.WebDAVUnknownElement.withName(property.namespace, property.name)
if code > 400: # Error codes only
log.err("Error during %s for %s: %s" % (self.method, property, message))
Modified: CalendarServer/trunk/twext/web2/dav/method/prop_common.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/method/prop_common.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/twext/web2/dav/method/prop_common.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -14,7 +14,7 @@
from twext.python.log import Logger
from twext.web2 import responsecode
from twext.web2.dav import davxml
-from twext.web2.dav.element.base import WebDAVElement
+from txdav.xml.base import WebDAVElement
from twext.web2.dav.http import statusForFailure
from twext.web2.dav.method.propfind import propertyName
Modified: CalendarServer/trunk/twext/web2/dav/method/put_common.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/method/put_common.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/twext/web2/dav/method/put_common.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -29,7 +29,7 @@
from twext.python.filepath import CachingFilePath as FilePath
from twext.web2 import responsecode
from twext.web2.dav import davxml
-from twext.web2.dav.element.base import dav_namespace
+from txdav.xml.base import dav_namespace
from twext.web2.dav.fileop import copy, delete, put
from twext.web2.dav.http import ErrorResponse
from twext.web2.dav.resource import TwistedGETContentMD5
Modified: CalendarServer/trunk/twext/web2/dav/method/report.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/method/report.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/twext/web2/dav/method/report.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -41,7 +41,7 @@
from twext.web2 import responsecode
from twext.web2.http import HTTPError, StatusResponse
from twext.web2.dav import davxml
-from twext.web2.dav.element.parser import lookupElement
+from txdav.xml.parser import lookupElement
from twext.web2.dav.http import ErrorResponse
from twext.web2.dav.util import davXMLFromStream
Modified: CalendarServer/trunk/twext/web2/dav/resource.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/resource.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/twext/web2/dav/resource.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -187,7 +187,7 @@
if type(property) is tuple:
qname = property
else:
- qname = property.qname()
+ qname = (property.namespace, property.name)
if qname[0] == twisted_private_namespace:
return succeed(False)
Modified: CalendarServer/trunk/twistedcaldav/customxml.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/customxml.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/twistedcaldav/customxml.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -25,7 +25,7 @@
from twext.web2.dav.davxml import dav_namespace
from twext.web2.dav.davxml import twisted_dav_namespace
-from twext.web2.dav.element.base import twisted_private_namespace
+from txdav.xml.base import twisted_private_namespace
from twext.web2.dav import davxml
from twistedcaldav import caldavxml, carddavxml
Modified: CalendarServer/trunk/twistedcaldav/directory/calendaruserproxy.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/calendaruserproxy.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/twistedcaldav/directory/calendaruserproxy.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -34,7 +34,7 @@
from twext.web2 import responsecode
from twext.web2.http import HTTPError, StatusResponse
from twext.web2.dav import davxml
-from twext.web2.dav.element.base import dav_namespace
+from txdav.xml.base import dav_namespace
from twext.web2.dav.util import joinURL
from twext.web2.dav.noneprops import NonePropertyStore
Modified: CalendarServer/trunk/twistedcaldav/directory/opendirectorybacker.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/opendirectorybacker.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/twistedcaldav/directory/opendirectorybacker.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -45,7 +45,7 @@
from twisted.internet.defer import inlineCallbacks, returnValue, deferredGenerator, succeed
from twext.python.filepath import CachingFilePath as FilePath
from twext.web2.dav import davxml
-from twext.web2.dav.element.base import twisted_dav_namespace, dav_namespace, parse_date, twisted_private_namespace
+from txdav.xml.base import twisted_dav_namespace, dav_namespace, parse_date, twisted_private_namespace
from twext.web2.dav.resource import DAVPropertyMixIn
from twext.web2.dav.util import joinURL
from twext.web2.http_headers import MimeType, generateContentType, ETag
Modified: CalendarServer/trunk/twistedcaldav/directorybackedaddressbook.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directorybackedaddressbook.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/twistedcaldav/directorybackedaddressbook.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -25,7 +25,7 @@
from twext.python.log import Logger
from twext.web2 import responsecode
from twext.web2.dav import davxml
-from twext.web2.dav.element.extensions import SyncCollection
+from txdav.xml.extensions import SyncCollection
from twext.web2.dav.resource import TwistedACLInheritable
from twext.web2.http import HTTPError, StatusResponse
Modified: CalendarServer/trunk/twistedcaldav/method/report.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/twistedcaldav/method/report.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -32,7 +32,7 @@
from twext.web2 import responsecode
from twext.web2.http import HTTPError, StatusResponse
from twext.web2.dav import davxml
-from twext.web2.dav.element.parser import lookupElement
+from txdav.xml.parser import lookupElement
from twext.web2.dav.util import davXMLFromStream
from twext.python.log import Logger
Modified: CalendarServer/trunk/twistedcaldav/method/report_common.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report_common.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/twistedcaldav/method/report_common.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -40,7 +40,7 @@
from twisted.python.failure import Failure
from twext.web2 import responsecode
from twext.web2.dav import davxml
-from twext.web2.dav.element.base import WebDAVElement
+from txdav.xml.base import WebDAVElement
from twext.web2.dav.http import statusForFailure
from twext.web2.dav.method.propfind import propertyName
from twext.web2.dav.method.report import NumberOfMatchesWithinLimits
Modified: CalendarServer/trunk/twistedcaldav/method/report_multiget_common.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report_multiget_common.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/twistedcaldav/method/report_multiget_common.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -25,7 +25,7 @@
from twext.python.log import Logger
from twext.web2 import responsecode
from twext.web2.dav import davxml
-from twext.web2.dav.element.base import dav_namespace
+from txdav.xml.base import dav_namespace
from twext.web2.dav.http import ErrorResponse, MultiStatusResponse
from twext.web2.dav.resource import AccessDeniedError
from twext.web2.dav.util import joinURL
Modified: CalendarServer/trunk/twistedcaldav/method/report_sync_collection.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report_sync_collection.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/twistedcaldav/method/report_sync_collection.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -28,8 +28,8 @@
from twisted.python.failure import Failure
from twext.web2 import responsecode
from twext.web2.dav import davxml
-from twext.web2.dav.element.base import WebDAVElement
-from twext.web2.dav.element.extensions import SyncCollection
+from txdav.xml.base import WebDAVElement
+from txdav.xml.extensions import SyncCollection
from twext.web2.dav.http import MultiStatusResponse, statusForFailure
from twext.web2.dav.method.prop_common import responseForHref
from twext.web2.dav.method.propfind import propertyName
Modified: CalendarServer/trunk/twistedcaldav/schedule.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/schedule.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/twistedcaldav/schedule.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -28,8 +28,8 @@
from twext.web2 import responsecode
from twext.web2.dav import davxml
-from twext.web2.dav.element.extensions import SyncCollection
-from twext.web2.dav.element.rfc2518 import HRef
+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
from twext.web2.dav.resource import davPrivilegeSet
Modified: CalendarServer/trunk/twistedcaldav/storebridge.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/storebridge.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/twistedcaldav/storebridge.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -18,7 +18,7 @@
from twext.python.log import Logger
from twext.web2 import responsecode
from twext.web2.dav import davxml
-from twext.web2.dav.element.base import dav_namespace, WebDAVUnknownElement
+from txdav.xml.base import dav_namespace, WebDAVUnknownElement
from twext.web2.dav.http import ErrorResponse, ResponseQueue, MultiStatusResponse
from twext.web2.dav.noneprops import NonePropertyStore
from twext.web2.dav.resource import TwistedACLInheritable, AccessDeniedError
@@ -630,7 +630,7 @@
davxml.HRef.fromString(""),
davxml.Status.fromResponseCode(code),
davxml.Error(
- WebDAVUnknownElement.fromQname(*error),
+ WebDAVUnknownElement.withName(*error),
customxml.UID.fromString(component.resourceUID()),
) if error else None,
)
@@ -787,7 +787,7 @@
davxml.HRef.fromString(""),
davxml.Status.fromResponseCode(code),
davxml.Error(
- WebDAVUnknownElement.fromQname(*error),
+ WebDAVUnknownElement.withName(*error),
customxml.UID.fromString(component.resourceUID()),
) if error else None,
)
@@ -845,7 +845,7 @@
davxml.HRef.fromString(href),
davxml.Status.fromResponseCode(code),
davxml.Error(
- WebDAVUnknownElement.fromQname(*error),
+ WebDAVUnknownElement.withName(*error),
) if error else None,
)
)
@@ -896,7 +896,7 @@
davxml.HRef.fromString(href),
davxml.Status.fromResponseCode(code),
davxml.Error(
- WebDAVUnknownElement.fromQname(*error),
+ WebDAVUnknownElement.withName(*error),
) if error else None,
)
)
Modified: CalendarServer/trunk/twistedcaldav/test/test_extensions.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_extensions.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/twistedcaldav/test/test_extensions.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -17,7 +17,7 @@
from twext.python.filepath import CachingFilePath as FilePath
from twext.web2.dav import davxml
-from twext.web2.dav.element.base import WebDAVElement
+from txdav.xml.base import WebDAVElement
from twext.web2.http_headers import MimeType
from twext.web2.static import MetaDataMixin
Modified: CalendarServer/trunk/twistedcaldav/test/test_resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_resource.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/twistedcaldav/test/test_resource.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -17,7 +17,7 @@
from twext.web2.dav import davxml
from twext.web2.dav.davxml import Principal
from twext.web2.dav.davxml import Unauthenticated
-from twext.web2.dav.element.rfc2518 import HRef
+from txdav.xml.rfc2518 import HRef
from twext.web2.http import HTTPError
from twext.web2.test.test_server import SimpleRequest
Modified: CalendarServer/trunk/txdav/base/datastore/file.py
===================================================================
--- CalendarServer/trunk/txdav/base/datastore/file.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/txdav/base/datastore/file.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -25,7 +25,7 @@
from txdav.idav import IDataStoreObject
from txdav.base.propertystore.base import PropertyName
-from twext.web2.dav.element.rfc2518 import GETContentType
+from txdav.xml.rfc2518 import GETContentType
from twext.web2.dav.resource import TwistedGETContentMD5
from twisted.python import hashlib
Modified: CalendarServer/trunk/txdav/base/propertystore/test/test_appledouble.py
===================================================================
--- CalendarServer/trunk/txdav/base/propertystore/test/test_appledouble.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/txdav/base/propertystore/test/test_appledouble.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -29,7 +29,7 @@
from txdav.base.propertystore.base import PropertyName
from twisted.python.filepath import FilePath
-from twext.web2.dav.element.rfc2518 import GETContentType, HRef, Depth
+from txdav.xml.rfc2518 import GETContentType, HRef, Depth
# This tar file contains a single file, 'f', with 2 xattrs; 'alpha' with
# contents 'beta', and 'gamma' with contents 'delta'.
Modified: CalendarServer/trunk/txdav/base/propertystore/test/test_xattr.py
===================================================================
--- CalendarServer/trunk/txdav/base/propertystore/test/test_xattr.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/txdav/base/propertystore/test/test_xattr.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -19,7 +19,7 @@
"""
from twext.python.filepath import CachingFilePath as FilePath
-from twext.web2.dav.element.base import WebDAVTextElement
+from txdav.xml.base import WebDAVTextElement
from txdav.base.propertystore.base import PropertyName
from txdav.base.propertystore.test import base
Modified: CalendarServer/trunk/txdav/caldav/datastore/file.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/file.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/txdav/caldav/datastore/file.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -38,7 +38,7 @@
from twext.python.vcomponent import VComponent
from twext.web2.dav import davxml
-from twext.web2.dav.element.rfc2518 import ResourceType, GETContentType
+from txdav.xml.rfc2518 import ResourceType, GETContentType
from twext.web2.dav.resource import TwistedGETContentMD5
from twext.web2.http_headers import generateContentType, MimeType
Modified: CalendarServer/trunk/txdav/caldav/datastore/sql.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/sql.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/txdav/caldav/datastore/sql.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -27,7 +27,7 @@
from twext.python.clsprop import classproperty
from twext.python.vcomponent import VComponent
-from twext.web2.dav.element.rfc2518 import ResourceType
+from txdav.xml.rfc2518 import ResourceType
from twext.web2.http_headers import MimeType, generateContentType
from twisted.internet.defer import inlineCallbacks, returnValue
Modified: CalendarServer/trunk/txdav/caldav/datastore/test/common.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/test/common.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/txdav/caldav/datastore/test/common.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -33,7 +33,7 @@
from twext.python.filepath import CachingFilePath as FilePath
from twext.web2.dav import davxml
from twext.web2.http_headers import MimeType
-from twext.web2.dav.element.base import WebDAVUnknownElement
+from txdav.xml.base import WebDAVUnknownElement
from twext.python.vcomponent import VComponent
from txdav.idav import IPropertyStore, IDataStore
Modified: CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/txdav/caldav/datastore/test/test_sql.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -27,7 +27,7 @@
from twext.enterprise.dal.syntax import Select, Parameter, Insert
from twext.python.vcomponent import VComponent
-from twext.web2.dav.element.rfc2518 import GETContentLanguage, ResourceType
+from txdav.xml.rfc2518 import GETContentLanguage, ResourceType
from txdav.base.propertystore.base import PropertyName
from txdav.caldav.datastore.test.common import CommonTests as CalendarCommonTests,\
Modified: CalendarServer/trunk/txdav/caldav/resource.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/resource.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/txdav/caldav/resource.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -31,7 +31,7 @@
import urllib
from twext.python.log import LoggingMixIn
-from twext.web2.dav.element.base import dav_namespace
+from txdav.xml.base import dav_namespace
from twext.web2.http_headers import MimeType
from twext.web2.http import RedirectResponse, Response
from twext.web2.stream import MemoryStream
Modified: CalendarServer/trunk/txdav/carddav/datastore/file.py
===================================================================
--- CalendarServer/trunk/txdav/carddav/datastore/file.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/txdav/carddav/datastore/file.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -29,7 +29,7 @@
from errno import ENOENT
-from twext.web2.dav.element.rfc2518 import ResourceType, GETContentType
+from txdav.xml.rfc2518 import ResourceType, GETContentType
from twext.web2.dav.resource import TwistedGETContentMD5
from twext.web2.http_headers import MimeType
Modified: CalendarServer/trunk/txdav/carddav/datastore/sql.py
===================================================================
--- CalendarServer/trunk/txdav/carddav/datastore/sql.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/txdav/carddav/datastore/sql.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -31,7 +31,7 @@
from twisted.internet.defer import inlineCallbacks, returnValue
from twisted.python import hashlib
-from twext.web2.dav.element.rfc2518 import ResourceType
+from txdav.xml.rfc2518 import ResourceType
from twext.web2.http_headers import MimeType
from twistedcaldav import carddavxml, customxml
Modified: CalendarServer/trunk/txdav/carddav/datastore/test/common.py
===================================================================
--- CalendarServer/trunk/txdav/carddav/datastore/test/common.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/txdav/carddav/datastore/test/common.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -42,7 +42,7 @@
from twext.python.filepath import CachingFilePath as FilePath
from twext.web2.dav import davxml
-from twext.web2.dav.element.base import WebDAVUnknownElement
+from txdav.xml.base import WebDAVUnknownElement
storePath = FilePath(__file__).parent().child("addressbook_store")
Modified: CalendarServer/trunk/txdav/carddav/datastore/test/test_sql.py
===================================================================
--- CalendarServer/trunk/txdav/carddav/datastore/test/test_sql.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/txdav/carddav/datastore/test/test_sql.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -20,7 +20,7 @@
"""
from twext.enterprise.dal.syntax import Select, Parameter
-from twext.web2.dav.element.rfc2518 import GETContentLanguage, ResourceType
+from txdav.xml.rfc2518 import GETContentLanguage, ResourceType
from twisted.internet.defer import inlineCallbacks, returnValue
from twisted.trial import unittest
Modified: CalendarServer/trunk/txdav/carddav/resource.py
===================================================================
--- CalendarServer/trunk/txdav/carddav/resource.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/txdav/carddav/resource.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -26,7 +26,7 @@
]
from twext.python.log import LoggingMixIn
-from twext.web2.dav.element.base import dav_namespace
+from txdav.xml.base import dav_namespace
from twistedcaldav.carddavxml import carddav_namespace
from twistedcaldav.config import config
Modified: CalendarServer/trunk/txdav/common/datastore/file.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/file.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/txdav/common/datastore/file.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -21,8 +21,8 @@
from twext.internet.decorate import memoizedKey
from twext.python.log import LoggingMixIn
-from twext.web2.dav.element.rfc2518 import ResourceType, GETContentType, HRef
-from twext.web2.dav.element.rfc5842 import ResourceID
+from txdav.xml.rfc2518 import ResourceType, GETContentType, HRef
+from txdav.xml.rfc5842 import ResourceID
from twext.web2.http_headers import generateContentType, MimeType
from twext.web2.dav.resource import TwistedGETContentMD5,\
TwistedQuotaUsedProperty
Modified: CalendarServer/trunk/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/txdav/common/datastore/sql.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -29,8 +29,8 @@
from zope.interface import implements, directlyProvides
from twext.python.log import Logger, LoggingMixIn
-from twext.web2.dav.element.rfc2518 import ResourceType
-from twext.web2.dav.element.parser import WebDAVDocument
+from txdav.xml.rfc2518 import ResourceType
+from txdav.xml.parser import WebDAVDocument
from twext.web2.http_headers import MimeType
from twisted.python import hashlib
Modified: CalendarServer/trunk/txdav/common/datastore/upgrade/sql/upgrades/upgrade_from_1_to_2.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/upgrade/sql/upgrades/upgrade_from_1_to_2.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/txdav/common/datastore/upgrade/sql/upgrades/upgrade_from_1_to_2.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -16,7 +16,7 @@
##
from twext.enterprise.dal.syntax import Update
-from twext.web2.dav.element.parser import WebDAVDocument
+from txdav.xml.parser import WebDAVDocument
from twisted.internet.defer import inlineCallbacks
from twistedcaldav import caldavxml
from txdav.common.datastore.sql_tables import schema
Modified: CalendarServer/trunk/txdav/common/inotifications.py
===================================================================
--- CalendarServer/trunk/txdav/common/inotifications.py 2012-03-16 00:10:47 UTC (rev 8879)
+++ CalendarServer/trunk/txdav/common/inotifications.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -88,7 +88,7 @@
C{CS:notificationtype} property.
@type xmltype: an instance of
- L{twext.web2.dav.element.base.WebDAVElement},
+ L{txdav.xml.base.WebDAVElement},
most likely a subclass like L{twistedcaldav.customxml.InviteReply},
L{twistedcaldav.customxml.InviteRemove}, etc.
Modified: CalendarServer/trunk/txdav/xml/__init__.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/element/__init__.py 2012-03-15 17:09:56 UTC (rev 8876)
+++ CalendarServer/trunk/txdav/xml/__init__.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -2,7 +2,7 @@
# See LICENSE for details.
##
-# Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
+# Copyright (c) 2005-1012 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
@@ -21,13 +21,10 @@
# 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.
-#
##
"""
-WebDAV XML Glue.
-
-Modules in this package provide the implementation of twext.web2.dav.davxml.
+WebDAV XML support.
"""
__all__ = [
Modified: CalendarServer/trunk/txdav/xml/base.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/element/base.py 2012-03-15 17:09:56 UTC (rev 8876)
+++ CalendarServer/trunk/txdav/xml/base.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -1,6 +1,6 @@
##
# Copyright (c) 2007 Twisted Matrix Laboratories.
-# Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
+# Copyright (c) 2005-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
@@ -19,8 +19,6 @@
# 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.
-#
-# DRI: Wilfredo Sanchez, wsanchez at apple.com
##
"""
@@ -48,11 +46,13 @@
import datetime
import string
import cStringIO as StringIO
+import re
from twext.python.log import Logger
from twext.web2.http_headers import parseDateTime
-from twext.web2.dav.element.util import decodeXMLName
+from txdav.xml.util import encodeXMLName, decodeXMLName
+
log = Logger()
##
@@ -63,6 +63,7 @@
twisted_dav_namespace = "http://twistedmatrix.com/xml_namespace/dav/"
twisted_private_namespace = twisted_dav_namespace + "private/"
+
class WebDAVElement (object):
"""
WebDAV XML element. (RFC 2518, section 12)
@@ -75,21 +76,14 @@
protected = False # See RFC 3253 section 1.4.1
unregistered = False # Subclass of factory; doesn't register
- def qname(cls):
- return (cls.namespace, cls.name)
-
- def sname(cls):
- return "{%s}%s" % (cls.namespace, cls.name)
-
- qname = classmethod(qname)
- sname = classmethod(sname)
-
def __init__(self, *children, **attributes):
super(WebDAVElement, self).__init__()
if self.allowed_children is None:
- raise NotImplementedError("WebDAVElement subclass %s is not implemented."
- % (self.__class__.__name__,))
+ raise NotImplementedError(
+ "WebDAVElement subclass %s is not implemented."
+ % (self.__class__.__name__,)
+ )
my_children = []
@@ -108,17 +102,25 @@
my_children.append(child)
self.children = tuple(my_children)
-
self.attributes = attributes
- def validate(self):
+ @classmethod
+ def qname(cls):
+ return (cls.namespace, cls.name)
+ @classmethod
+ def sname(cls):
+ return encodeXMLName(cls.namespace, cls.name)
+
+ def validate(self):
children = self.children
attributes = self.attributes
if self.allowed_children is None:
- raise NotImplementedError("WebDAVElement subclass %s is not implemented."
- % (self.__class__.__name__,))
+ raise NotImplementedError(
+ "WebDAVElement subclass %s is not implemented."
+ % (self.__class__.__name__,)
+ )
#
# Validate that children are of acceptable types
@@ -155,13 +157,15 @@
break
else:
if not (isinstance(child, PCDATAElement) and child.isWhitespace()):
- log.msg("Child of type %s is unexpected and therefore ignored in %s element"
- % (child.sname(), self.sname()))
+ log.debug(
+ "Child of type %s is unexpected and therefore ignored in %s element"
+ % (child.sname(), self.sname())
+ )
for qname, (min, max) in allowed_children.items():
if min != 0:
- raise ValueError("Not enough children of type {%s}%s for %s"
- % (qname[0], qname[1], self.sname()))
+ raise ValueError("Not enough children of type %s for %s"
+ % (encodeXMLName(*qname), self.sname()))
self.children = tuple(my_children)
@@ -173,7 +177,7 @@
if self.allowed_attributes:
for name in attributes:
if name not in self.allowed_attributes:
- log.msg("Attribute %s is unexpected in %s element" % (name, self.sname()))
+ log.debug("Attribute %s is unexpected in %s element" % (name, self.sname()))
my_attributes[name] = attributes[name]
for name, required in self.allowed_attributes.items():
@@ -183,15 +187,12 @@
else:
if not isinstance(self, WebDAVUnknownElement) and attributes:
- log.msg("Attributes %s are unexpected in %s element"
- % (attributes.keys(), self.sname()))
+ log.debug("Attributes %s are unexpected in %s element"
+ % (attributes.keys(), self.sname()))
my_attributes.update(attributes)
self.attributes = my_attributes
- def emptyCopy(self):
- return self.__class__()
-
def __str__(self):
return self.sname()
@@ -218,13 +219,11 @@
def __contains__(self, child):
return child in self.children
-
def writeXML(self, output, pretty=True):
output.write("<?xml version='1.0' encoding='UTF-8'?>" + ("\n" if pretty else ""))
- self.writeToStream(output, "", 0, pretty)
+ self._writeToStream(output, "", 0, pretty)
-
- def writeToStream(self, output, ns, level, pretty):
+ def _writeToStream(self, output, ns, level, pretty):
"""
Fast XML output.
@@ -246,7 +245,7 @@
if self.attributes or (ns != self.namespace):
output.write("<%s" % (self.name,))
for name, value in self.attributes.iteritems():
- self.writeAttributeToStream(output, name, value)
+ self._writeAttributeToStream(output, name, value)
if ns != self.namespace:
output.write(" xmlns='%s'" % (self.namespace,))
output.write("/>")
@@ -257,7 +256,7 @@
if self.attributes or (ns != self.namespace):
output.write("<%s" % (self.name,))
for name, value in self.attributes.iteritems():
- self.writeAttributeToStream(output, name, value)
+ self._writeAttributeToStream(output, name, value)
if ns != self.namespace:
output.write(" xmlns='%s'" % (self.namespace,))
ns = self.namespace
@@ -277,7 +276,7 @@
if pretty and not hasPCDATA:
output.write("\r\n")
for child in self.children:
- child.writeToStream(output, ns, level+1, pretty)
+ child._writeToStream(output, ns, level+1, pretty)
# Close the element.
if pretty and not hasPCDATA and level:
@@ -287,7 +286,7 @@
if pretty and level:
output.write("\r\n")
- def writeAttributeToStream(self, output, name, value):
+ def _writeAttributeToStream(self, output, name, value):
# Quote any single quotes. We do not need to be any smarter than this.
value = value.replace("'", "'")
@@ -367,12 +366,8 @@
newchildren.append(child)
self.children = tuple(newchildren)
-class PCDATAElement (object):
- def sname(self): return "#PCDATA"
- qname = classmethod(sname)
- sname = classmethod(sname)
-
+class PCDATAElement (object):
def __init__(self, data):
super(PCDATAElement, self).__init__()
@@ -385,6 +380,14 @@
self.data = data
+ @classmethod
+ def qname(cls):
+ return (None, "#PCDATA")
+
+ @classmethod
+ def sname(cls):
+ return "#PCDATA"
+
def validate(self):
pass
@@ -427,7 +430,7 @@
log.err("Invalid PCDATA: %r" % (self.data,))
raise
- def writeToStream(self, output, ns, level, pretty):
+ def _writeToStream(self, output, ns, level, pretty):
# Do escaping/CDATA behavior
if "\r" in self.data or "\n" in self.data:
# Do CDATA
@@ -443,6 +446,7 @@
output.write(cdata)
+
class WebDAVOneShotElement (WebDAVElement):
"""
Element with exactly one WebDAVEmptyElement child and no attributes.
@@ -474,6 +478,7 @@
return WebDAVOneShotElement.__singletons[clazz][child]
+
class WebDAVUnknownElement (WebDAVElement):
"""
Placeholder for unknown element tag names.
@@ -484,7 +489,7 @@
}
@classmethod
- def fromQname(cls, namespace, name):
+ def withName(cls, namespace, name):
child = cls()
child.namespace = namespace
child.name = name
@@ -494,13 +499,8 @@
return (self.namespace, self.name)
def sname(self):
- return "{%s}%s" % (self.namespace, self.name)
+ return encodeXMLName(self.namespace, self.name)
- def emptyCopy(self):
- copied = self.__class__()
- copied.name = self.name
- copied.namespace = self.namespace
- return copied
class WebDAVEmptyElement (WebDAVElement):
"""
@@ -519,10 +519,8 @@
return WebDAVEmptyElement.__singletons[clazz]
allowed_children = {}
-
children = ()
-
def __hash__(self):
"""
Define a hash method, so that an empty element can serve as dictionary
@@ -532,7 +530,6 @@
return hash((self.name, self.namespace))
-
class WebDAVTextElement (WebDAVElement):
"""
WebDAV element containing PCDATA.
@@ -566,10 +563,12 @@
else:
return NotImplemented
+
class WebDAVDateTimeElement (WebDAVTextElement):
"""
WebDAV date-time element. (RFC 2518, section 23.2)
"""
+ @classmethod
def fromDate(clazz, date):
"""
date may be a datetime.datetime instance, a POSIX timestamp
@@ -595,8 +594,6 @@
return clazz(PCDATAElement(date))
- fromDate = classmethod(fromDate)
-
def __init__(self, *children, **attributes):
super(WebDAVDateTimeElement, self).__init__(*children, **attributes)
self.datetime() # Raise ValueError if the format is wrong
@@ -614,11 +611,13 @@
else:
return parse_date(s)
+
class DateTimeHeaderElement (WebDAVTextElement):
"""
WebDAV date-time element for elements that substitute for HTTP
headers. (RFC 2068, section 3.3.1)
"""
+ @classmethod
def fromDate(clazz, date):
"""
date may be a datetime.datetime instance, a POSIX timestamp
@@ -648,8 +647,6 @@
return clazz(PCDATAElement(date))
- fromDate = classmethod(fromDate)
-
def __init__(self, *children, **attributes):
super(DateTimeHeaderElement, self).__init__(*children, **attributes)
self.datetime() # Raise ValueError if the format is wrong
@@ -667,6 +664,7 @@
else:
return parseDateTime(s)
+
##
# Utilities
##
@@ -685,26 +683,22 @@
def tzname (self, dt): return self._name
def dst (self, dt): return datetime.timedelta(0)
+
+_regex_ISO8601Date = re.compile(
+ "^" +
+ "(?P<year>\d{4})-(?P<month>\d{2})-(?P<day>\d{2})T" +
+ "(?P<hour>\d{2}):(?P<minute>\d{2}):(?P<second>\d{2})(?:.(?P<subsecond>\d+))*" +
+ "(?:Z|(?P<offset_sign>\+|-)(?P<offset_hour>\d{2}):(?P<offset_minute>\d{2}))" +
+ "$"
+)
+
def parse_date(date):
"""
Parse an ISO 8601 date and return a corresponding datetime.datetime object.
"""
# See http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html
- global regex_date
-
- if regex_date is None:
- import re
-
- regex_date = re.compile(
- "^" +
- "(?P<year>\d{4})-(?P<month>\d{2})-(?P<day>\d{2})T" +
- "(?P<hour>\d{2}):(?P<minute>\d{2}):(?P<second>\d{2})(?:.(?P<subsecond>\d+))*" +
- "(?:Z|(?P<offset_sign>\+|-)(?P<offset_hour>\d{2}):(?P<offset_minute>\d{2}))" +
- "$"
- )
-
- match = regex_date.match(date)
+ match = _regex_ISO8601Date.match(date)
if match is not None:
subsecond = match.group("subsecond")
if subsecond is None:
@@ -736,5 +730,3 @@
)
else:
raise ValueError("Invalid ISO 8601 date format: %r" % (date,))
-
-regex_date = None
Modified: CalendarServer/trunk/txdav/xml/extensions.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/element/extensions.py 2012-03-15 17:09:56 UTC (rev 8876)
+++ CalendarServer/trunk/txdav/xml/extensions.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -37,8 +37,8 @@
"SyncLevel",
]
-from twext.web2.dav.element.base import WebDAVElement, WebDAVTextElement
-from twext.web2.dav.element.base import dav_namespace, twisted_dav_namespace
+from txdav.xml.base import WebDAVElement, WebDAVTextElement
+from txdav.xml.base import dav_namespace, twisted_dav_namespace
class CurrentUserPrincipal(WebDAVElement):
@@ -52,6 +52,7 @@
(dav_namespace, "unauthenticated" ) : (0, 1),
}
+
class ErrorDescription(WebDAVTextElement):
"""
The human-readable description of a failed precondition
@@ -60,6 +61,7 @@
name = "error-description"
protected = True
+
class AddMember (WebDAVElement):
"""
A property on a collection to allow for "anonymous" creation of resources.
@@ -71,6 +73,7 @@
allowed_children = { (dav_namespace, "href"): (0, 1) }
+
class SyncCollection (WebDAVElement):
"""
DAV report used to retrieve specific calendar component items via their
@@ -108,6 +111,7 @@
raise ValueError("Only one of DAV:prop allowed")
self.property = child
+
class SyncToken (WebDAVTextElement):
"""
Synchronization token used in report and as a property.
@@ -116,6 +120,7 @@
hidden = True
protected = True
+
class SyncLevel (WebDAVTextElement):
"""
Synchronization level used in report.
Modified: CalendarServer/trunk/txdav/xml/parser.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/element/parser.py 2012-03-15 17:09:56 UTC (rev 8876)
+++ CalendarServer/trunk/txdav/xml/parser.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -1,5 +1,5 @@
##
-# Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
+# Copyright (c) 2005-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
@@ -18,8 +18,6 @@
# 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.
-#
-# DRI: Wilfredo Sanchez, wsanchez at apple.com
##
"""
@@ -41,13 +39,16 @@
import xml.dom.minidom
import xml.sax
-from twext.web2.dav.element.base import WebDAVElement, WebDAVUnknownElement, PCDATAElement
-from twext.web2.dav.element.util import PrintXML
+from txdav.xml.base import WebDAVElement, WebDAVUnknownElement, PCDATAElement
+from txdav.xml.util import PrintXML
##
# Parsing
##
+_elements_by_tag_name = {}
+
+
def registerElements(module):
"""
Register XML elements defined in the given module with the parser.
@@ -67,30 +68,31 @@
return element_names
+
def registerElement(element_class, element_names=None):
"""
Register the supplied XML elements with the parser.
"""
qname = element_class.namespace, element_class.name
- if qname in elements_by_tag_name:
+ if qname in _elements_by_tag_name:
raise AssertionError(
"Attempting to register qname %s multiple times: (%r, %r)"
- % (qname, elements_by_tag_name[qname], element_class)
+ % (qname, _elements_by_tag_name[qname], element_class)
)
- if not (qname in elements_by_tag_name and issubclass(element_class, elements_by_tag_name[qname])):
- elements_by_tag_name[qname] = element_class
+ if not (qname in _elements_by_tag_name and issubclass(element_class, _elements_by_tag_name[qname])):
+ _elements_by_tag_name[qname] = element_class
if element_names is not None:
element_names.append(element_class.__name__)
+
def lookupElement(qname):
"""
Return the element class for the element with the given qname.
"""
- return elements_by_tag_name[qname]
+ return _elements_by_tag_name[qname]
-elements_by_tag_name = {}
class WebDAVContentHandler (xml.sax.handler.ContentHandler):
def setDocumentLocator(self, locator): self.locator = locator
@@ -143,8 +145,8 @@
tag_namespace, tag_name = name
- if name in elements_by_tag_name:
- element_class = elements_by_tag_name[name]
+ if name in _elements_by_tag_name:
+ element_class = _elements_by_tag_name[name]
elif name in self.unknownElementClasses:
element_class = self.unknownElementClasses[name]
else:
@@ -207,6 +209,7 @@
def skippedEntity(self, name):
raise AssertionError("skipped entities are not allowed")
+
class WebDAVDocument (object):
"""
WebDAV XML document.
Modified: CalendarServer/trunk/txdav/xml/rfc2518.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/element/rfc2518.py 2012-03-15 17:09:56 UTC (rev 8876)
+++ CalendarServer/trunk/txdav/xml/rfc2518.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -18,8 +18,6 @@
# 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.
-#
-# DRI: Wilfredo Sanchez, wsanchez at apple.com
##
"""
@@ -31,9 +29,11 @@
"""
from twext.web2 import responsecode
-from twext.web2.dav.element.base import *
from twext.web2.http_headers import MimeType
+from txdav.xml.base import *
+
+
##
# Section 12
##
@@ -53,6 +53,7 @@
(dav_namespace, "locktoken"): (0, 1),
}
+
class Depth (WebDAVTextElement):
"""
The value of the depth header. (RFC 2518, section 12.1.1)
@@ -66,6 +67,7 @@
if depth not in ("0", "1", "infinity"):
raise ValueError("Invalid depth: %s" % (depth,))
+
class LockToken (WebDAVElement):
"""
The lock token associated with a lock. (RFC 2518, section 12.1.2)
@@ -74,24 +76,28 @@
allowed_children = { (dav_namespace, "href"): (1, None) }
+
class Timeout (WebDAVTextElement):
"""
The timeout associated with a lock. (RFC 2518, section 12.1.3)
"""
name = "timeout"
+
class Collection (WebDAVEmptyElement):
"""
Identifies the associated resource as a collection. (RFC 2518, section 12.2)
"""
name = "collection"
+
class HRef (WebDAVTextElement):
"""
Identifies the content of the element as a URI. (RFC 2518, section 12.3)
"""
name = "href"
+
class Link (WebDAVElement):
"""
Identifies the property as a link and contains the source and
@@ -104,18 +110,21 @@
(dav_namespace, "dst"): (1, None),
}
+
class LinkDestination (WebDAVTextElement):
"""
Indicates the destination of a link. (RFC 2518, section 12.4.1)
"""
name = "dst"
+
class LinkSource (WebDAVTextElement):
"""
Indicates the source of a link. (RFC 2518, section 12.4.2)
"""
name = "src"
+
class LockEntry (WebDAVElement):
"""
Defines the types of lock that can be used with the
@@ -128,6 +137,7 @@
(dav_namespace, "locktype" ): (1, 1),
}
+
class LockInfo (WebDAVElement):
"""
Used with a LOCK method to specify the type of lock that the
@@ -141,6 +151,7 @@
(dav_namespace, "owner" ): (0, 1),
}
+
class LockScope (WebDAVOneShotElement):
"""
Specifies whether a lock is an exclusive lock or a shared
@@ -153,6 +164,7 @@
(dav_namespace, "shared" ): (0, 1),
}
+
class Exclusive (WebDAVEmptyElement):
"""
Indicates an exclusive lock. (RFC 2518, section 12.7.1)
@@ -161,6 +173,7 @@
LockScope.exclusive = LockScope(Exclusive())
+
class Shared (WebDAVEmptyElement):
"""
Indicates a shared lock. (RFC 2518, section 12.7.2)
@@ -169,6 +182,7 @@
LockScope.shared = LockScope(Shared())
+
class LockType (WebDAVOneShotElement):
"""
Specifies the access type of a lock. (RFC 2518, section 12.8)
@@ -177,6 +191,7 @@
allowed_children = { (dav_namespace, "write"): (0, 1) }
+
class Write (WebDAVEmptyElement):
"""
Indicates a write lock. (RFC 2518, section 12.8.1)
@@ -188,6 +203,7 @@
LockType.write = LockType(Write())
+
class MultiStatus (WebDAVElement):
"""
Contains multiple Responses. (RFC 2518, section 12.9)
@@ -199,6 +215,7 @@
(dav_namespace, "responsedescription"): (0, 1),
}
+
class Response (WebDAVElement):
"""
Holds a single response describing the effect of a method on a
@@ -246,6 +263,7 @@
return StatusResponse.__new__(StatusResponse, *children)
+
class StatusResponse (Response):
"""
Specialized derivative of Response for resource status.
@@ -259,6 +277,7 @@
(dav_namespace, "responsedescription"): (0, 1),
}
+
class PropertyStatusResponse (Response):
"""
Specialized derivative of Response for property status.
@@ -272,6 +291,7 @@
(dav_namespace, "responsedescription"): (0, 1),
}
+
class PropertyStatus (WebDAVElement):
"""
Groups together a Property and Status element that is associated
@@ -286,6 +306,7 @@
(dav_namespace, "responsedescription"): (0, 1),
}
+
class Status (WebDAVTextElement):
"""
Holds a single HTTP status line. (RFC 2518, section 12.9.1.2)
@@ -317,6 +338,7 @@
self.code = code
+
class ResponseDescription (WebDAVTextElement):
"""
Contains a message that can be displayed to the user explaining the nature
@@ -324,6 +346,7 @@
"""
name = "responsedescription"
+
class Owner (WebDAVElement):
"""
Property which provides information about the principal taking out a lock.
@@ -339,6 +362,7 @@
allowed_children = { WebDAVElement: (0, None) }
+
class PropertyContainer (WebDAVElement):
"""
Contains properties related to a resource. (RFC 2518, section 12.11)
@@ -347,6 +371,7 @@
allowed_children = { WebDAVElement: (0, None) }
+
class PropertyBehavior (WebDAVElement):
"""
Specifies how properties are handled during a COPY or MOVE. (RFC 2518,
@@ -370,6 +395,7 @@
self.behavior = children[0]
+
class KeepAlive (WebDAVElement):
"""
Specifies requirements for the copying/moving or live properties. (RFC 2518,
@@ -400,6 +426,7 @@
if str(self) != "*":
raise ValueError("Invalid keepalive value: %r", (str(self),))
+
class Omit (WebDAVEmptyElement):
"""
Instructs the server that it should use best effort to copy properties. (RFC
@@ -407,6 +434,7 @@
"""
name = "omit"
+
class PropertyUpdate (WebDAVElement):
"""
Contains a request to alter the properties on a resource. (RFC 2518, section
@@ -419,6 +447,7 @@
(dav_namespace, "set" ): (0, None),
}
+
class Remove (WebDAVElement):
"""
Lists the DAV properties to be removed from a resource. (RFC 2518, section
@@ -428,6 +457,7 @@
allowed_children = { (dav_namespace, "prop"): (1, 1) }
+
class Set (WebDAVElement):
"""
Lists the DAV properties to be set for a resource. (RFC 2518, section
@@ -437,6 +467,7 @@
allowed_children = { (dav_namespace, "prop"): (1, 1) }
+
class PropertyFind (WebDAVElement):
"""
Specifies the properties to be returned from a PROPFIND
@@ -459,6 +490,7 @@
% (self.sname(), self.children)
)
+
class AllProperties (WebDAVEmptyElement):
"""
Specifies that all property names and values on the resource are
@@ -466,6 +498,7 @@
"""
name = "allprop"
+
class PropertyName (WebDAVEmptyElement):
"""
Specifies that only a list of property names on the resource are
@@ -473,6 +506,7 @@
"""
name = "propname"
+
##
# Section 13
##
@@ -486,6 +520,7 @@
# MAY be protected as per RFC2518bis. We may make this more flexible later.
protected = True
+
class DisplayName (WebDAVTextElement):
"""
Provides a name for the resource that is suitable for presentation
@@ -493,6 +528,7 @@
"""
name = "displayname"
+
class GETContentLanguage (WebDAVTextElement):
"""
Contains the Content-Language header returned by a GET without
@@ -500,6 +536,7 @@
"""
name = "getcontentlanguage"
+
class GETContentLength (WebDAVTextElement):
"""
Contains the Content-Length header returned by a GET without
@@ -508,6 +545,7 @@
name = "getcontentlength"
protected = True
+
class GETContentType (WebDAVTextElement):
"""
Contains the Content-Type header returned by a GET without
@@ -518,6 +556,7 @@
def mimeType(self):
return MimeType.fromString(str(self))
+
class GETETag (WebDAVTextElement):
"""
Contains the ETag header returned by a GET without
@@ -526,6 +565,7 @@
name = "getetag"
protected = True
+
class GETLastModified (DateTimeHeaderElement):
"""
Contains the Last-Modified header returned by a GET without accept
@@ -534,6 +574,7 @@
name = "getlastmodified"
protected = True
+
class LockDiscovery (WebDAVElement):
"""
Describes the active locks on a resource. (RFC 2518, section 13.8)
@@ -543,6 +584,7 @@
allowed_children = { (dav_namespace, "activelock"): (0, None) }
+
class ResourceType (WebDAVElement):
"""
Specifies the nature of the resource. (RFC 2518, section 13.9)
@@ -555,6 +597,7 @@
ResourceType.collection = ResourceType(Collection())
ResourceType.empty = ResourceType()
+
class Source (WebDAVElement):
"""
The destination of the source link identifies the resource that
@@ -565,6 +608,7 @@
allowed_children = { (dav_namespace, "link"): (0, None) }
+
class SupportedLock (WebDAVElement):
"""
Provides a listing of the lock capabilities supported by the
@@ -575,8 +619,10 @@
allowed_children = { (dav_namespace, "lockentry"): (0, None) }
+
# Pre-conditions codes defined in RFC4918
+
class PropfindFiniteDepth (WebDAVEmptyElement):
"""
Error which indicates Depth:infinity PROPFIND not allowed
Modified: CalendarServer/trunk/txdav/xml/rfc3253.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/element/rfc3253.py 2012-03-15 17:09:56 UTC (rev 8876)
+++ CalendarServer/trunk/txdav/xml/rfc3253.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -1,5 +1,5 @@
##
-# Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
+# Copyright (c) 2005-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
@@ -18,8 +18,6 @@
# 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.
-#
-# DRI: Wilfredo Sanchez, wsanchez at apple.com
##
"""
@@ -30,8 +28,9 @@
See RFC 3253: http://www.ietf.org/rfc/rfc3253.txt
"""
-from twext.web2.dav.element.base import *
+from txdav.xml.base import *
+
##
# Section 1
##
@@ -46,6 +45,7 @@
allowed_children = { WebDAVElement: (0, None) }
+
##
# Section 3
##
@@ -59,6 +59,7 @@
name = "comment"
hidden = True
+
class CreatorDisplayName (WebDAVTextElement):
"""
Property which contains a description of the creator of the resource that is
@@ -67,6 +68,7 @@
name = "creator-displayname"
hidden = True
+
class SupportedMethod (WebDAVElement):
"""
Property which identifies a method that is supported by a resource. A method
@@ -81,6 +83,7 @@
allowed_children = { WebDAVElement: (0, None) }
allowed_attributes = { "name": True }
+
class SupportedMethodSet (WebDAVElement):
"""
Property which identifies the methods that are supported by a resource. (RFC
@@ -92,6 +95,7 @@
allowed_children = { (dav_namespace, "supported-method"): (0, None) }
+
class SupportedLiveProperty (WebDAVElement):
"""
Property which identifies a live property that is supported by a resource. A
@@ -106,6 +110,7 @@
# FIXME: Where is the name element defined?
allowed_children = { (dav_namespace, "name"): (1, 1) }
+
class SupportedLivePropertySet (WebDAVElement):
"""
Property which identifies the live properties that are supported by a
@@ -117,6 +122,7 @@
allowed_children = { (dav_namespace, "supported-live-property"): (0, None) }
+
class Report (WebDAVElement):
"""
A report. (RFC 3253, section 3.1.5)
@@ -126,6 +132,7 @@
allowed_children = { WebDAVElement: (0, None) }
+
class SupportedReport (WebDAVElement):
"""
Identifies a report that is supported by the resource. (RFC 3253, section
@@ -158,6 +165,7 @@
#
allowed_children = { (dav_namespace, "report"): (0, 1) }
+
class SupportedReportSet (WebDAVElement):
"""
Property which identifies the reports that are supported by the resource.
@@ -169,6 +177,7 @@
allowed_children = { (dav_namespace, "supported-report"): (0, None) }
+
class ExpandProperty (WebDAVElement):
"""
Report which provides a mechanism for retrieving in one request the
@@ -179,6 +188,7 @@
allowed_children = { (dav_namespace, "property"): (0, None) }
+
class Property (WebDAVElement):
"""
Identifies a property by name. (RFC 3253, section 3.8)
Modified: CalendarServer/trunk/txdav/xml/rfc3744.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/element/rfc3744.py 2012-03-15 17:09:56 UTC (rev 8876)
+++ CalendarServer/trunk/txdav/xml/rfc3744.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -1,5 +1,5 @@
##
-# Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
+# Copyright (c) 2005-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
@@ -18,8 +18,6 @@
# 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.
-#
-# DRI: Wilfredo Sanchez, wsanchez at apple.com
##
"""
@@ -30,8 +28,11 @@
See RFC 3744: http://www.ietf.org/rfc/rfc3744.txt
"""
-from twext.web2.dav.element.base import *
+from txdav.xml.base import dav_namespace
+from txdav.xml.base import WebDAVElement, PCDATAElement
+from txdav.xml.base import WebDAVEmptyElement, WebDAVTextElement
+
##
# Section 3 (Privileges)
##
@@ -44,8 +45,11 @@
"""
name = "read"
-# For DAV:write element (RFC 3744, section 3.2) see Write class above.
+# For DAV:write element (RFC 3744, section 3.2) see Write class in
+# rfc2518.py.
+
+
class WriteProperties (WebDAVEmptyElement):
"""
Privilege which controls methods that modify the dead properties of a
@@ -53,6 +57,7 @@
"""
name = "write-properties"
+
class WriteContent (WebDAVEmptyElement):
"""
Privilege which controls methods that modify the content of an existing
@@ -60,6 +65,7 @@
"""
name = "write-content"
+
class Unlock (WebDAVEmptyElement):
"""
Privilege which controls the use of the UNLOCK method by a principal other
@@ -67,6 +73,7 @@
"""
name = "unlock"
+
class ReadACL (WebDAVEmptyElement):
"""
Privilege which controls the use of the PROPFIND method to retrieve the
@@ -74,6 +81,7 @@
"""
name = "read-acl"
+
class ReadCurrentUserPrivilegeSet (WebDAVEmptyElement):
"""
Privilege which controls the use of the PROPFIND method to retrieve the
@@ -82,6 +90,7 @@
"""
name = "read-current-user-privilege-set"
+
class WriteACL (WebDAVEmptyElement):
"""
Privilege which controls the use of the ACL method to modify the DAV:acl
@@ -89,6 +98,7 @@
"""
name = "write-acl"
+
class Bind (WebDAVEmptyElement):
"""
Privilege which allows a method to add a new member URL from the a
@@ -96,6 +106,7 @@
"""
name = "bind"
+
class Unbind (WebDAVEmptyElement):
"""
Privilege which allows a method to remove a member URL from the a collection
@@ -103,6 +114,7 @@
"""
name = "unbind"
+
class All (WebDAVEmptyElement):
"""
Aggregate privilege that contains the entire set of privileges that can be
@@ -111,6 +123,7 @@
"""
name = "all"
+
##
# Section 4 (Principal Properties)
##
@@ -142,6 +155,7 @@
% (self.sname(), self.children)
)
+
class AlternateURISet (WebDAVElement):
"""
Property which contains the URIs of network resources with additional
@@ -153,6 +167,7 @@
allowed_children = { (dav_namespace, "href"): (0, None) }
+
class PrincipalURL (WebDAVElement):
"""
Property which contains the URL that must be used to identify this principal
@@ -164,6 +179,7 @@
allowed_children = { (dav_namespace, "href"): (0, 1) }
+
class GroupMemberSet (WebDAVElement):
"""
Property which identifies the principals that are direct members of a group
@@ -175,6 +191,7 @@
allowed_children = { (dav_namespace, "href"): (0, None) }
+
class GroupMembership (WebDAVElement):
"""
Property which identifies the group principals in which a principal is
@@ -186,12 +203,15 @@
allowed_children = { (dav_namespace, "href"): (0, None) }
+
##
# Section 5 (Access Control Properties)
##
-# For DAV:owner element (RFC 3744, section 5.1) see Owner class above.
+# For DAV:owner element (RFC 3744, section 5.1) see Owner class in
+# rfc2518.py.
+
class Group (WebDAVElement):
"""
Property which identifies a particular principal as being the group
@@ -203,6 +223,7 @@
allowed_children = { (dav_namespace, "href"): (0, 1) }
+
class SupportedPrivilegeSet (WebDAVElement):
"""
Property which identifies the privileges defined for a resource. (RFC 3744,
@@ -214,6 +235,7 @@
allowed_children = { (dav_namespace, "supported-privilege"): (0, None) }
+
class SupportedPrivilege (WebDAVElement):
"""
Identifies a privilege defined for a resource. (RFC 3744, section 5.3)
@@ -227,6 +249,7 @@
(dav_namespace, "supported-privilege"): (0, None),
}
+
class Privilege (WebDAVElement):
"""
Identifies a privilege. (RFC 3744, sections 5.3 and 5.5.1)
@@ -319,12 +342,14 @@
return aggregates
+
class Abstract (WebDAVElement):
"""
Identifies a privilege as abstract. (RFC 3744, section 5.3)
"""
name = "abstract"
+
class Description (WebDAVTextElement):
"""
A human-readable description of what privilege controls access to. (RFC
@@ -333,6 +358,7 @@
name = "description"
allowed_attributes = { "xml:lang": True }
+
class CurrentUserPrivilegeSet (WebDAVElement):
"""
Property which contains the exact set of privileges (as computer by the
@@ -345,8 +371,10 @@
allowed_children = { (dav_namespace, "privilege"): (0, None) }
+
# For DAV:privilege element (RFC 3744, section 5.4) see Privilege class above.
+
class ACL (WebDAVElement):
"""
Property which specifies the list of access control entries which define
@@ -359,6 +387,7 @@
allowed_children = { (dav_namespace, "ace"): (0, None) }
+
class ACE (WebDAVElement):
"""
Specifies the list of access control entries which define what privileges
@@ -440,24 +469,32 @@
)
assert self.privileges is not None
-# For DAV:principal element (RFC 3744, section 5.5.1) see Principal class above.
+# For DAV:principal element (RFC 3744, section 5.5.1) see Principal
+# class above.
+
+
# For DAV:all element (RFC 3744, section 5.5.1) see All class above.
+
class Authenticated (WebDAVEmptyElement):
"""
Principal which matches authenticated users. (RFC 3744, section 5.5.1)
"""
name = "authenticated"
+
class Unauthenticated (WebDAVEmptyElement):
"""
Principal which matches unauthenticated users. (RFC 3744, section 5.5.1)
"""
name = "unauthenticated"
-# For DAV:property element (RFC 3744, section 5.5.1) see Property class above.
+# For DAV:property element (RFC 3744, section 5.5.1) see Property
+# class above.
+
+
class Self (WebDAVEmptyElement):
"""
Principal which matches a user if a resource is a principal and the user
@@ -465,6 +502,7 @@
"""
name = "self"
+
class Invert (WebDAVElement):
"""
Principal which matches a user if the user does not match the principal
@@ -474,6 +512,7 @@
allowed_children = { (dav_namespace, "principal"): (1, 1) }
+
class Grant (WebDAVElement):
"""
Grants the contained privileges to a principal. (RFC 3744, section 5.5.2)
@@ -482,6 +521,7 @@
allowed_children = { (dav_namespace, "privilege"): (1, None) }
+
class Deny (WebDAVElement):
"""
Denies the contained privileges to a principal. (RFC 3744, section 5.5.2)
@@ -490,14 +530,18 @@
allowed_children = { (dav_namespace, "privilege"): (1, None) }
-# For DAV:privilege element (RFC 3744, section 5.5.2) see Privilege class above.
+# For DAV:privilege element (RFC 3744, section 5.5.2) see Privilege
+# class above.
+
+
class Protected (WebDAVEmptyElement):
"""
Identifies an ACE as protected. (RFC 3744, section 5.5.3)
"""
name = "protected"
+
class Inherited (WebDAVElement):
"""
Indicates that an ACE is inherited from the resource indentified by the
@@ -507,6 +551,7 @@
allowed_children = { (dav_namespace, "href"): (1, 1) }
+
class ACLRestrictions (WebDAVElement):
"""
Property which defines the types of ACLs supported by this server, to avoid
@@ -523,6 +568,7 @@
(dav_namespace, "required-principal"): (0, 1),
}
+
class GrantOnly (WebDAVEmptyElement):
"""
Indicates that ACEs with deny clauses are not allowed. (RFC 3744, section
@@ -530,6 +576,7 @@
"""
name = "grant-only"
+
class NoInvert (WebDAVEmptyElement):
"""
Indicates that ACEs with the DAV:invert element are not allowed. (RFC 3744,
@@ -537,6 +584,7 @@
"""
name = "no-invert"
+
class DenyBeforeGrant (WebDAVEmptyElement):
"""
Indicates that all deny ACEs must precede all grant ACEs. (RFC 3744, section
@@ -544,6 +592,7 @@
"""
name = "deny-before-grant"
+
class RequiredPrincipal (WebDAVElement):
"""
Indicates which principals must have an ACE defined in an ACL. (RFC 3744,
@@ -575,6 +624,7 @@
% (self.sname(), self.children)
)
+
class InheritedACLSet (WebDAVElement):
"""
Property which contains a set of URLs that identify other resources that
@@ -586,6 +636,7 @@
allowed_children = { (dav_namespace, "href"): (0, None) }
+
class PrincipalCollectionSet (WebDAVElement):
"""
Property which contains a set of URLs that identify the root collections
@@ -598,6 +649,7 @@
allowed_children = { (dav_namespace, "href"): (0, None) }
+
##
# Section 7 (Access Control and existing methods)
##
@@ -610,6 +662,7 @@
allowed_children = { (dav_namespace, "resource"): (0, None) }
+
class Resource (WebDAVElement):
"""
Identifies which resource had insufficient privileges. (RFC 3744, section
@@ -622,6 +675,7 @@
(dav_namespace, "privilege"): (1, 1),
}
+
##
# Section 9 (Access Control Reports)
##
@@ -651,6 +705,7 @@
)
prop = True
+
class PrincipalMatch (WebDAVElement):
"""
Report used to identify all members (at any depth) of the collection
@@ -691,6 +746,7 @@
% (self.sname(), self.children)
)
+
class PrincipalProperty (WebDAVElement):
"""
Identifies a property. (RFC 3744, section 9.3)
@@ -699,8 +755,10 @@
allowed_children = { WebDAVElement: (0, None) }
+
# For DAV:self element (RFC 3744, section 9.3) see Self class above.
+
class PrincipalPropertySearch (WebDAVElement):
"""
Report which performs a search for all principals whose properties contain
@@ -716,6 +774,7 @@
}
allowed_attributes = { "test": False }
+
class PropertySearch (WebDAVElement):
"""
Contains a DAV:prop element enumerating the properties to be searched and a
@@ -728,12 +787,14 @@
(dav_namespace, "match"): (1, 1),
}
+
class Match (WebDAVTextElement):
"""
Contains a search string. (RFC 3744, section 9.4)
"""
name = "match"
+
class PrincipalSearchPropertySet (WebDAVElement):
"""
Report which identifies those properties that may be searched using the
@@ -743,6 +804,7 @@
allowed_children = { (dav_namespace, "principal-search-property"): (0, None) }
+
class PrincipalSearchProperty (WebDAVElement):
"""
Contains exactly one searchable property, and a description of the property.
@@ -755,10 +817,13 @@
(dav_namespace, "description"): (1, 1),
}
+
class NumberOfMatchesWithinLimits (WebDAVEmptyElement):
"""
Error which indicates too many results
"""
name = "number-of-matches-within-limits"
-# For DAV:description element (RFC 3744, section 9.5) see Description class above.
+
+# For DAV:description element (RFC 3744, section 9.5) see Description
+# class above.
Modified: CalendarServer/trunk/txdav/xml/rfc4331.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/element/rfc4331.py 2012-03-15 17:09:56 UTC (rev 8876)
+++ CalendarServer/trunk/txdav/xml/rfc4331.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -18,8 +18,6 @@
# 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.
-#
-# DRI: Cyrus Daboo, cdaboo at apple.com
##
"""
@@ -30,8 +28,9 @@
See RFC 4331: http://www.ietf.org/rfc/rfc4331.txt
"""
-from twext.web2.dav.element.base import WebDAVTextElement
+from txdav.xml.base import WebDAVTextElement
+
##
# Section 3 & 4 (Quota Properties)
##
@@ -45,6 +44,7 @@
hidden = True
protected = True
+
class QuotaUsedBytes (WebDAVTextElement):
"""
Property which contains the the number of bytes used under the
Modified: CalendarServer/trunk/txdav/xml/rfc5842.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/element/rfc5842.py 2012-03-15 17:09:56 UTC (rev 8876)
+++ CalendarServer/trunk/txdav/xml/rfc5842.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -1,5 +1,5 @@
##
-# Copyright (c) 2005-2007 Apple Inc. All rights reserved.
+# Copyright (c) 2005-2012 Apple 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
@@ -18,12 +18,10 @@
# 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.
-#
-# DRI: Cyrus Daboo, cdaboo at apple.com
##
-from twext.web2.dav.element.base import WebDAVTextElement, WebDAVElement,\
- dav_namespace
+from txdav.xml.base import WebDAVTextElement, WebDAVElement
+from txdav.xml.base import dav_namespace
"""
RFC 5842 (Binding Extensions to WebDAV) XML Elements
@@ -43,6 +41,7 @@
allowed_children = { (dav_namespace, "href"): (0, 1) }
+
class ParentSet (WebDAVElement):
"""
Identifies other bindings to a resource
@@ -53,6 +52,7 @@
allowed_children = { (dav_namespace, "parent"): (0, 1) }
+
class Parent (WebDAVElement):
name = "parent"
@@ -62,13 +62,19 @@
(dav_namespace, "segment") : (1, 1),
}
+
class Segment (WebDAVTextElement):
name = "segment"
+
# Problem: DAV:bind is also defined in RFC3744 but with our XML element parsing/mapping behavior
# we are not allowed to have two class with the same qname(). So we are stuck.
+#
+# FIXME: redefine bind in rfc3744.py (with a note) to allow
+# sub-elements and so that can extend it here.
+
#class BindResponse (WebDAVElement):
# """
# Response body for a BIND request
@@ -80,6 +86,7 @@
# # ANY
# }
#
+#
#class UnbindRequest (WebDAVElement):
# """
# Request body for a UNBIND request
@@ -91,6 +98,7 @@
# (dav_namespace, "segment") : (1, 1),
# }
#
+#
#class Unbind (WebDAVElement):
# """
# Response body for a UNBIND request
@@ -102,6 +110,7 @@
# # ANY
# }
#
+#
#class RebindRequest (WebDAVElement):
# """
# Request body for a REBIND request
@@ -114,6 +123,7 @@
# (dav_namespace, "href") : (1, 1),
# }
#
+#
#class Rebind (WebDAVElement):
# """
# Response body for a UNBIND request
Modified: CalendarServer/trunk/txdav/xml/util.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/element/util.py 2012-03-15 17:09:56 UTC (rev 8876)
+++ CalendarServer/trunk/txdav/xml/util.py 2012-03-16 01:12:29 UTC (rev 8880)
@@ -1,5 +1,5 @@
##
-# Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
+# Copyright (c) 2005-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
@@ -18,8 +18,6 @@
# 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.
-#
-# DRI: Wilfredo Sanchez, wsanchez at apple.com
##
"""
@@ -35,31 +33,33 @@
"decodeXMLName",
]
+
def PrintXML(document, stream):
try:
import xml.dom.ext as ext
except ImportError:
- import twext.web2.dav.element.xmlext as ext
+ import txdav.xml.xmlext as ext
document.normalize()
ext.Print(document, stream)
# For debugging, this is easier to read: (FIXME: disable for normal use)
#ext.PrettyPrint(document, stream)
-def encodeXMLName(name):
+
+def encodeXMLName(namespace, name):
"""
- Encodes an XML (namespace, localname) pair into an ASCII string.
- If namespace is None, returns localname encoded as UTF-8.
- Otherwise, returns {namespace}localname encoded as UTF-8.
+ Encodes an XML namespace and name into a UTF-8 string.
+ If namespace is None, returns "name", otherwise, returns
+ "{namespace}name".
"""
- namespace, name = name
if namespace is None: return name.encode("utf-8")
return (u"{%s}%s" % (namespace, name)).encode("utf-8")
+
def decodeXMLName(name):
"""
- Decodes an XML (namespace, localname) pair from an ASCII string as encoded
- by encodeXMLName().
+ Decodes an XML (namespace, name) pair from an ASCII string as
+ encoded by encodeXMLName().
"""
if name[0] is not "{": return (None, name.decode("utf-8"))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120315/817413d6/attachment-0001.html>
More information about the calendarserver-changes
mailing list