[CalendarServer-changes] [1205] CalendarServer/branches/users/cdaboo/sqlprops-1202/lib-patches/ Twisted

source_changes at macosforge.org source_changes at macosforge.org
Sat Feb 17 10:35:23 PST 2007


Revision: 1205
          http://trac.macosforge.org/projects/calendarserver/changeset/1205
Author:   cdaboo at apple.com
Date:     2007-02-17 10:35:23 -0800 (Sat, 17 Feb 2007)

Log Message:
-----------
Fix unknown element behavior so that unknown properties are represented by classes that can be
pickled.

Modified Paths:
--------------
    CalendarServer/branches/users/cdaboo/sqlprops-1202/lib-patches/Twisted/twisted.web2.dav.element.base.patch
    CalendarServer/branches/users/cdaboo/sqlprops-1202/lib-patches/Twisted/twisted.web2.dav.element.parser.patch

Added Paths:
-----------
    CalendarServer/branches/users/cdaboo/sqlprops-1202/lib-patches/Twisted/twisted.web2.dav.http.patch

Modified: CalendarServer/branches/users/cdaboo/sqlprops-1202/lib-patches/Twisted/twisted.web2.dav.element.base.patch
===================================================================
--- CalendarServer/branches/users/cdaboo/sqlprops-1202/lib-patches/Twisted/twisted.web2.dav.element.base.patch	2007-02-17 18:01:37 UTC (rev 1204)
+++ CalendarServer/branches/users/cdaboo/sqlprops-1202/lib-patches/Twisted/twisted.web2.dav.element.base.patch	2007-02-17 18:35:23 UTC (rev 1205)
@@ -31,9 +31,13 @@
  
          self.attributes = my_attributes
  
-@@ -190,14 +189,93 @@
+@@ -189,15 +188,97 @@
+     def __contains__(self, child):
          return child in self.children
  
++    def cloneEmpty(self):
++        return self.__class__()
++
      def writeXML(self, output):
 -        document = xml.dom.minidom.Document()
 -        self.addToDOM(document, None)
@@ -129,7 +133,7 @@
  
      def element(self, document):
          element = document.createElementNS(self.namespace, self.name)
-@@ -324,6 +402,22 @@
+@@ -324,6 +405,22 @@
              log.err("Invalid PCDATA: %r" % (self.data,))
              raise
  
@@ -152,3 +156,25 @@
  class WebDAVOneShotElement (WebDAVElement):
      """
      Element with exactly one WebDAVEmptyElement child and no attributes.
+@@ -364,6 +461,21 @@
+         PCDATAElement: (0, None),
+     }
+ 
++    def _qname(self):
++        return (self.namespace, self.name)
++
++    def _sname(self):
++        return "{%s}%s" % (self.namespace, self.name)
++
++    qname = _qname
++    sname = _sname
++
++    def cloneEmpty(self):
++        dup = self.__class__()
++        dup.namespace = self.namespace
++        dup.name = self.name
++        return dup
++
+ class WebDAVEmptyElement (WebDAVElement):
+     """
+     WebDAV element with no contents.

Modified: CalendarServer/branches/users/cdaboo/sqlprops-1202/lib-patches/Twisted/twisted.web2.dav.element.parser.patch
===================================================================
--- CalendarServer/branches/users/cdaboo/sqlprops-1202/lib-patches/Twisted/twisted.web2.dav.element.parser.patch	2007-02-17 18:01:37 UTC (rev 1204)
+++ CalendarServer/branches/users/cdaboo/sqlprops-1202/lib-patches/Twisted/twisted.web2.dav.element.parser.patch	2007-02-17 18:35:23 UTC (rev 1205)
@@ -44,18 +44,30 @@
  
 -        if (name not in elements_by_tag_name):
 -            class UnknownElement (WebDAVUnknownElement):
+-                namespace = tag_namespace
+-                name      = tag_name
+-            element_class = UnknownElement
 +        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:
-+            class UnknownElement (self.unknownElementClass):
-                 namespace = tag_namespace
-                 name      = tag_name
-             element_class = UnknownElement
--        else:
+         else:
 -            element_class = elements_by_tag_name[name]
-+            self.unknownElementClasses[name] = UnknownElement
++            #class UnknownElement (self.unknownElementClass):
++            #    namespace = tag_namespace
++            #    name      = tag_name
++            element_class = WebDAVUnknownElement
++            #self.unknownElementClasses[name] = UnknownElement
  
          self.stack.append({
              "name"       : name,
+@@ -151,6 +176,9 @@
+         # children.
+         try:
+             element = top["class"](*top["children"], **top["attributes"])
++            if top["class"] == WebDAVUnknownElement:
++                element.namespace = name[0]
++                element.name = name[1]
+         except ValueError, e:
+             e.args = ("%s at %s" % (e.args[0], self.location()),) + e.args[1:]
+             raise # Re-raises modified e, but preserves traceback

Added: CalendarServer/branches/users/cdaboo/sqlprops-1202/lib-patches/Twisted/twisted.web2.dav.http.patch
===================================================================
--- CalendarServer/branches/users/cdaboo/sqlprops-1202/lib-patches/Twisted/twisted.web2.dav.http.patch	                        (rev 0)
+++ CalendarServer/branches/users/cdaboo/sqlprops-1202/lib-patches/Twisted/twisted.web2.dav.http.patch	2007-02-17 18:35:23 UTC (rev 1205)
@@ -0,0 +1,13 @@
+Index: twisted/web2/dav/http.py
+===================================================================
+--- twisted/web2/dav/http.py	(revision 18545)
++++ twisted/web2/dav/http.py	(working copy)
+@@ -227,7 +227,7 @@
+ 
+         if len(property.children) > 0:
+             # Re-instantiate as empty element.
+-            property = property.__class__()
++            property = property.cloneEmpty()
+ 
+         if code > 400: # Error codes only
+             log.err("Error during %s for %s: %s" % (self.method, property, message))

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070217/b9e45b3a/attachment.html


More information about the calendarserver-changes mailing list