[CalendarServer-changes] [2066]
CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.element.
parser.patch
source_changes at macosforge.org
source_changes at macosforge.org
Wed Dec 12 09:00:57 PST 2007
Revision: 2066
http://trac.macosforge.org/projects/calendarserver/changeset/2066
Author: cdaboo at apple.com
Date: 2007-12-12 09:00:55 -0800 (Wed, 12 Dec 2007)
Log Message:
-----------
Coalesce adjacent PCDATAElements, so that XML character data that contains ignorable whitespace
(e.g. \r\n) is stored in a single PCDataElement ratehr than multiple elements. This ensures that
when the XML is printed out the character data appears inside a single CDATA section rather than
having multiple CDATA sections around each run of ignorable whitespace.
Modified Paths:
--------------
CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.element.parser.patch
Modified: CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.element.parser.patch
===================================================================
--- CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.element.parser.patch 2007-12-12 00:58:32 UTC (rev 2065)
+++ CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.element.parser.patch 2007-12-12 17:00:55 UTC (rev 2066)
@@ -68,7 +68,21 @@
self.stack.append({
"name" : name,
-@@ -194,6 +219,8 @@
+@@ -158,7 +183,12 @@
+ self.stack[-1]["children"].append(element)
+
+ def characters(self, content):
+- self.stack[-1]["children"].append(PCDATAElement(content))
++ # Coalesce adjacent PCDATAElements
++ pcdata = PCDATAElement(content)
++ if len(self.stack[-1]["children"]) and isinstance(self.stack[-1]["children"][-1], PCDATAElement):
++ self.stack[-1]["children"][-1] = self.stack[-1]["children"][-1] + pcdata
++ else:
++ self.stack[-1]["children"].append(pcdata)
+
+ def ignorableWhitespace(self, whitespace):
+ self.characters(self, whitespace)
+@@ -194,6 +224,8 @@
except xml.sax.SAXParseException, e:
raise ValueError(e)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20071212/0f25202c/attachment.html
More information about the calendarserver-changes
mailing list