[CalendarServer-changes] [4340] CalDAVTester/trunk/verifiers/dataMatch.py
source_changes at macosforge.org
source_changes at macosforge.org
Fri Jun 12 20:05:37 PDT 2009
Revision: 4340
http://trac.macosforge.org/projects/calendarserver/changeset/4340
Author: cdaboo at apple.com
Date: 2009-06-12 20:05:37 -0700 (Fri, 12 Jun 2009)
Log Message:
-----------
Normalize XML data before comparison.
Modified Paths:
--------------
CalDAVTester/trunk/verifiers/dataMatch.py
Modified: CalDAVTester/trunk/verifiers/dataMatch.py
===================================================================
--- CalDAVTester/trunk/verifiers/dataMatch.py 2009-06-12 16:12:16 UTC (rev 4339)
+++ CalDAVTester/trunk/verifiers/dataMatch.py 2009-06-13 03:05:37 UTC (rev 4340)
@@ -18,6 +18,8 @@
Verifier that checks the response body for an exact match to data in a file.
"""
+import xml.dom.minidom
+
class Verifier(object):
def verify(self, manager, uri, response, respdata, args): #@UnusedVariable
@@ -61,9 +63,17 @@
respdata = respdata.replace("\r\n ", "")
if data != respdata:
result = False
+ elif files[0].endswith(".xml"):
+ try:
+ respdata = xml.dom.minidom.parseString( respdata ).toprettyxml("", "")
+ data = xml.dom.minidom.parseString( data ).toprettyxml("", "")
+ except Exception, ex:
+ return False, " Could not parse XML: %s" %(ex,)
+ if data != respdata:
+ result = False
else:
result = False
-
+
if result:
return True, ""
else:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20090612/fa030dfe/attachment.html>
More information about the calendarserver-changes
mailing list