[CalendarServer-changes] [8890] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Fri Mar 16 11:00:21 PDT 2012
Revision: 8890
http://trac.macosforge.org/projects/calendarserver/changeset/8890
Author: wsanchez at apple.com
Date: 2012-03-16 11:00:21 -0700 (Fri, 16 Mar 2012)
Log Message:
-----------
Get rif of util.py
Modified Paths:
--------------
CalendarServer/trunk/twext/web2/dav/davxml.py
CalendarServer/trunk/txdav/xml/base.py
Removed Paths:
-------------
CalendarServer/trunk/txdav/xml/util.py
Modified: CalendarServer/trunk/twext/web2/dav/davxml.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/davxml.py 2012-03-16 17:00:28 UTC (rev 8889)
+++ CalendarServer/trunk/twext/web2/dav/davxml.py 2012-03-16 18:00:21 UTC (rev 8890)
@@ -42,7 +42,6 @@
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 *
@@ -56,7 +55,6 @@
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
@@ -67,7 +65,6 @@
__all__ = (
registerElements(b) +
registerElements(p) +
- registerElements(u) +
registerElements(r1) +
registerElements(r2) +
registerElements(r3) +
Modified: CalendarServer/trunk/txdav/xml/base.py
===================================================================
--- CalendarServer/trunk/txdav/xml/base.py 2012-03-16 17:00:28 UTC (rev 8889)
+++ CalendarServer/trunk/txdav/xml/base.py 2012-03-16 18:00:21 UTC (rev 8890)
@@ -33,6 +33,8 @@
"dav_namespace",
"twisted_dav_namespace",
"twisted_private_namespace",
+ "encodeXMLName",
+ "decodeXMLName",
"WebDAVElement",
"PCDATAElement",
"WebDAVOneShotElement",
@@ -51,8 +53,6 @@
from twext.python.log import Logger
from twext.web2.http_headers import parseDateTime
-from txdav.xml.util import encodeXMLName, decodeXMLName
-
log = Logger()
##
@@ -64,6 +64,31 @@
twisted_private_namespace = twisted_dav_namespace + "private/"
+def encodeXMLName(namespace, name):
+ """
+ Encodes an XML namespace and name into a UTF-8 string.
+ If namespace is None, returns "name", otherwise, returns
+ "{namespace}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, name) pair from an ASCII string as
+ encoded by encodeXMLName().
+ """
+ if name[0] is not "{": return (None, name.decode("utf-8"))
+
+ index = name.find("}")
+
+ if (index is -1 or not len(name) > index):
+ raise ValueError("Invalid encoded name: %r" % (name,))
+
+ return (name[1:index].decode("utf-8"), name[index+1:].decode("utf-8"))
+
+
class WebDAVElement (object):
"""
WebDAV XML element. (RFC 2518, section 12)
Deleted: CalendarServer/trunk/txdav/xml/util.py
===================================================================
--- CalendarServer/trunk/txdav/xml/util.py 2012-03-16 17:00:28 UTC (rev 8889)
+++ CalendarServer/trunk/txdav/xml/util.py 2012-03-16 18:00:21 UTC (rev 8890)
@@ -1,59 +0,0 @@
-##
-# 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
-# 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.
-##
-
-"""
-WebDAV XML utilities.
-
-This module provides XML utilities for use with WebDAV.
-
-See RFC 2518: http://www.ietf.org/rfc/rfc2518.txt (WebDAV)
-"""
-
-__all__ = [
- "encodeXMLName",
- "decodeXMLName",
-]
-
-
-def encodeXMLName(namespace, name):
- """
- Encodes an XML namespace and name into a UTF-8 string.
- If namespace is None, returns "name", otherwise, returns
- "{namespace}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, name) pair from an ASCII string as
- encoded by encodeXMLName().
- """
- if name[0] is not "{": return (None, name.decode("utf-8"))
-
- index = name.find("}")
-
- if (index is -1 or not len(name) > index):
- raise ValueError("Invalid encoded name: %r" % (name,))
-
- return (name[1:index].decode("utf-8"), name[index+1:].decode("utf-8"))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120316/5f42f5a5/attachment.html>
More information about the calendarserver-changes
mailing list