[Zope3-checkins] SVN: Zope3/branches/isarsprint-dav-work/src/zope/app/dav/tests/test_propfind.py Significantly reduce the XML literals by reusing the already generated

Martijn Pieters mj at zopatista.com
Sun Oct 10 14:58:40 EDT 2004


Log message for revision 27934:
  Significantly reduce the XML literals by reusing the already generated
  snippets.
  


Changed:
  U   Zope3/branches/isarsprint-dav-work/src/zope/app/dav/tests/test_propfind.py


-=-
Modified: Zope3/branches/isarsprint-dav-work/src/zope/app/dav/tests/test_propfind.py
===================================================================
--- Zope3/branches/isarsprint-dav-work/src/zope/app/dav/tests/test_propfind.py	2004-10-10 18:44:52 UTC (rev 27933)
+++ Zope3/branches/isarsprint-dav-work/src/zope/app/dav/tests/test_propfind.py	2004-10-10 18:58:40 UTC (rev 27934)
@@ -463,122 +463,44 @@
         expect = '''<?xml version="1.0" ?>
         <multistatus xmlns="DAV:">
         <response>
-        <href>http://127.0.0.1/folder/</href>
+        <href>%(resource_url)s</href>
         <propstat>
         <prop xmlns:a0="http://www.purl.org/dc/1.1">
-        <title xmlns="a0"/>
-        <description xmlns="a0"/>
-        <created xmlns="a0"/>
-        <modified xmlns="a0"/>
-        <effective xmlns="a0"/>
-        <expires xmlns="a0"/>
-        <creators xmlns="a0"/>
-        <subjects xmlns="a0"/>
-        <publisher xmlns="a0"/>
-        <contributors xmlns="a0"/>
-        <creationdate/>
-        <displayname/>
-        <source/>
-        <getcontentlanguage/>
-        <getcontentlength/>
-        <getcontenttype/>
-        <getetag/>
-        <getlastmodified/>
-        <resourcetype/>
-        <lockdiscovery/>
-        <supportedlock/>
+        %(props_xml)s
         </prop>
         <status>HTTP/1.1 200 OK</status>
         </propstat>
         </response>
         <response>
-        <href>http://127.0.0.1/folder/1</href>
+        <href>%(resource_url)s1</href>
         <propstat>
         <prop xmlns:a0="http://www.purl.org/dc/1.1">
-        <title xmlns="a0"/>
-        <description xmlns="a0"/>
-        <created xmlns="a0"/>
-        <modified xmlns="a0"/>
-        <effective xmlns="a0"/>
-        <expires xmlns="a0"/>
-        <creators xmlns="a0"/>
-        <subjects xmlns="a0"/>
-        <publisher xmlns="a0"/>
-        <contributors xmlns="a0"/>
-        <creationdate/>
-        <displayname/>
-        <source/>
-        <getcontentlanguage/>
-        <getcontentlength/>
-        <getcontenttype/>
-        <getetag/>
-        <getlastmodified/>
-        <resourcetype/>
-        <lockdiscovery/>
-        <supportedlock/>
+        %(props_xml)s
         </prop>
         <status>HTTP/1.1 200 OK</status>
         </propstat>
         </response>
         <response>
-        <href>http://127.0.0.1/folder/2</href>
+        <href>%(resource_url)s2</href>
         <propstat>
         <prop xmlns:a0="http://www.purl.org/dc/1.1">
-        <title xmlns="a0"/>
-        <description xmlns="a0"/>
-        <created xmlns="a0"/>
-        <modified xmlns="a0"/>
-        <effective xmlns="a0"/>
-        <expires xmlns="a0"/>
-        <creators xmlns="a0"/>
-        <subjects xmlns="a0"/>
-        <publisher xmlns="a0"/>
-        <contributors xmlns="a0"/>
-        <creationdate/>
-        <displayname/>
-        <source/>
-        <getcontentlanguage/>
-        <getcontentlength/>
-        <getcontenttype/>
-        <getetag/>
-        <getlastmodified/>
-        <resourcetype/>
-        <lockdiscovery/>
-        <supportedlock/>
+        %(props_xml)s
         </prop>
         <status>HTTP/1.1 200 OK</status>
         </propstat>
         </response>
         <response>
-        <href>http://127.0.0.1/folder/sub1/</href>
+        <href>%(resource_url)ssub1/</href>
         <propstat>
         <prop xmlns:a0="http://www.purl.org/dc/1.1">
-        <title xmlns="a0"/>
-        <description xmlns="a0"/>
-        <created xmlns="a0"/>
-        <modified xmlns="a0"/>
-        <effective xmlns="a0"/>
-        <expires xmlns="a0"/>
-        <creators xmlns="a0"/>
-        <subjects xmlns="a0"/>
-        <publisher xmlns="a0"/>
-        <contributors xmlns="a0"/>
-        <creationdate/>
-        <displayname/>
-        <source/>
-        <getcontentlanguage/>
-        <getcontentlength/>
-        <getcontenttype/>
-        <getetag/>
-        <getlastmodified/>
-        <resourcetype/>
-        <lockdiscovery/>
-        <supportedlock/>
+        %(props_xml)s
         </prop>
         <status>HTTP/1.1 200 OK</status>
         </propstat>
         </response>
-        </multistatus>'''
+        </multistatus>''' % {
+            'resource_url': resource_url,
+            'props_xml': props_xml}
 
 
         pfind = propfind.PROPFIND(folder, request)
@@ -617,238 +539,80 @@
         expect = '''<?xml version="1.0" ?>
         <multistatus xmlns="DAV:">
         <response>
-        <href>http://127.0.0.1/folder/</href>
+        <href>%(resource_url)s</href>
         <propstat>
         <prop xmlns:a0="http://www.purl.org/dc/1.1">
-        <title xmlns="a0"/>
-        <description xmlns="a0"/>
-        <created xmlns="a0"/>
-        <modified xmlns="a0"/>
-        <effective xmlns="a0"/>
-        <expires xmlns="a0"/>
-        <creators xmlns="a0"/>
-        <subjects xmlns="a0"/>
-        <publisher xmlns="a0"/>
-        <contributors xmlns="a0"/>
-        <creationdate/>
-        <displayname/>
-        <source/>
-        <getcontentlanguage/>
-        <getcontentlength/>
-        <getcontenttype/>
-        <getetag/>
-        <getlastmodified/>
-        <resourcetype/>
-        <lockdiscovery/>
-        <supportedlock/>
+        %(props_xml)s
         </prop>
         <status>HTTP/1.1 200 OK</status>
         </propstat>
         </response>
         <response>
-        <href>http://127.0.0.1/folder/1</href>
+        <href>%(resource_url)s1</href>
         <propstat>
         <prop xmlns:a0="http://www.purl.org/dc/1.1">
-        <title xmlns="a0"/>
-        <description xmlns="a0"/>
-        <created xmlns="a0"/>
-        <modified xmlns="a0"/>
-        <effective xmlns="a0"/>
-        <expires xmlns="a0"/>
-        <creators xmlns="a0"/>
-        <subjects xmlns="a0"/>
-        <publisher xmlns="a0"/>
-        <contributors xmlns="a0"/>
-        <creationdate/>
-        <displayname/>
-        <source/>
-        <getcontentlanguage/>
-        <getcontentlength/>
-        <getcontenttype/>
-        <getetag/>
-        <getlastmodified/>
-        <resourcetype/>
-        <lockdiscovery/>
-        <supportedlock/>
+        %(props_xml)s
         </prop>
         <status>HTTP/1.1 200 OK</status>
         </propstat>
         </response>
         <response>
-        <href>http://127.0.0.1/folder/2</href>
+        <href>%(resource_url)s2</href>
         <propstat>
         <prop xmlns:a0="http://www.purl.org/dc/1.1">
-        <title xmlns="a0"/>
-        <description xmlns="a0"/>
-        <created xmlns="a0"/>
-        <modified xmlns="a0"/>
-        <effective xmlns="a0"/>
-        <expires xmlns="a0"/>
-        <creators xmlns="a0"/>
-        <subjects xmlns="a0"/>
-        <publisher xmlns="a0"/>
-        <contributors xmlns="a0"/>
-        <creationdate/>
-        <displayname/>
-        <source/>
-        <getcontentlanguage/>
-        <getcontentlength/>
-        <getcontenttype/>
-        <getetag/>
-        <getlastmodified/>
-        <resourcetype/>
-        <lockdiscovery/>
-        <supportedlock/>
+        %(props_xml)s
         </prop>
         <status>HTTP/1.1 200 OK</status>
         </propstat>
         </response>
         <response>
-        <href>http://127.0.0.1/folder/sub1/</href>
+        <href>%(resource_url)ssub1/</href>
         <propstat>
         <prop xmlns:a0="http://www.purl.org/dc/1.1">
-        <title xmlns="a0"/>
-        <description xmlns="a0"/>
-        <created xmlns="a0"/>
-        <modified xmlns="a0"/>
-        <effective xmlns="a0"/>
-        <expires xmlns="a0"/>
-        <creators xmlns="a0"/>
-        <subjects xmlns="a0"/>
-        <publisher xmlns="a0"/>
-        <contributors xmlns="a0"/>
-        <creationdate/>
-        <displayname/>
-        <source/>
-        <getcontentlanguage/>
-        <getcontentlength/>
-        <getcontenttype/>
-        <getetag/>
-        <getlastmodified/>
-        <resourcetype/>
-        <lockdiscovery/>
-        <supportedlock/>
+        %(props_xml)s
         </prop>
         <status>HTTP/1.1 200 OK</status>
         </propstat>
         </response>
         <response>
-        <href>http://127.0.0.1/folder/sub1/1</href>
+        <href>%(resource_url)ssub1/1</href>
         <propstat>
         <prop xmlns:a0="http://www.purl.org/dc/1.1">
-        <title xmlns="a0"/>
-        <description xmlns="a0"/>
-        <created xmlns="a0"/>
-        <modified xmlns="a0"/>
-        <effective xmlns="a0"/>
-        <expires xmlns="a0"/>
-        <creators xmlns="a0"/>
-        <subjects xmlns="a0"/>
-        <publisher xmlns="a0"/>
-        <contributors xmlns="a0"/>
-        <creationdate/>
-        <displayname/>
-        <source/>
-        <getcontentlanguage/>
-        <getcontentlength/>
-        <getcontenttype/>
-        <getetag/>
-        <getlastmodified/>
-        <resourcetype/>
-        <lockdiscovery/>
-        <supportedlock/>
+        %(props_xml)s
         </prop>
         <status>HTTP/1.1 200 OK</status>
         </propstat>
         </response>
         <response>
-        <href>http://127.0.0.1/folder/sub1/2</href>
+        <href>%(resource_url)ssub1/2</href>
         <propstat>
         <prop xmlns:a0="http://www.purl.org/dc/1.1">
-        <title xmlns="a0"/>
-        <description xmlns="a0"/>
-        <created xmlns="a0"/>
-        <modified xmlns="a0"/>
-        <effective xmlns="a0"/>
-        <expires xmlns="a0"/>
-        <creators xmlns="a0"/>
-        <subjects xmlns="a0"/>
-        <publisher xmlns="a0"/>
-        <contributors xmlns="a0"/>
-        <creationdate/>
-        <displayname/>
-        <source/>
-        <getcontentlanguage/>
-        <getcontentlength/>
-        <getcontenttype/>
-        <getetag/>
-        <getlastmodified/>
-        <resourcetype/>
-        <lockdiscovery/>
-        <supportedlock/>
+        %(props_xml)s
         </prop>
         <status>HTTP/1.1 200 OK</status>
         </propstat>
         </response>
         <response>
-        <href>http://127.0.0.1/folder/sub1/sub1/</href>
+        <href>%(resource_url)ssub1/sub1/</href>
         <propstat>
         <prop xmlns:a0="http://www.purl.org/dc/1.1">
-        <title xmlns="a0"/>
-        <description xmlns="a0"/>
-        <created xmlns="a0"/>
-        <modified xmlns="a0"/>
-        <effective xmlns="a0"/>
-        <expires xmlns="a0"/>
-        <creators xmlns="a0"/>
-        <subjects xmlns="a0"/>
-        <publisher xmlns="a0"/>
-        <contributors xmlns="a0"/>
-        <creationdate/>
-        <displayname/>
-        <source/>
-        <getcontentlanguage/>
-        <getcontentlength/>
-        <getcontenttype/>
-        <getetag/>
-        <getlastmodified/>
-        <resourcetype/>
-        <lockdiscovery/>
-        <supportedlock/>
+        %(props_xml)s
         </prop>
         <status>HTTP/1.1 200 OK</status>
         </propstat>
         </response>
         <response>
-        <href>http://127.0.0.1/folder/sub1/sub1/last</href>
+        <href>%(resource_url)ssub1/sub1/last</href>
         <propstat>
         <prop xmlns:a0="http://www.purl.org/dc/1.1">
-        <title xmlns="a0"/>
-        <description xmlns="a0"/>
-        <created xmlns="a0"/>
-        <modified xmlns="a0"/>
-        <effective xmlns="a0"/>
-        <expires xmlns="a0"/>
-        <creators xmlns="a0"/>
-        <subjects xmlns="a0"/>
-        <publisher xmlns="a0"/>
-        <contributors xmlns="a0"/>
-        <creationdate/>
-        <displayname/>
-        <source/>
-        <getcontentlanguage/>
-        <getcontentlength/>
-        <getcontenttype/>
-        <getetag/>
-        <getlastmodified/>
-        <resourcetype/>
-        <lockdiscovery/>
-        <supportedlock/>
+        %(props_xml)s
         </prop>
         <status>HTTP/1.1 200 OK</status>
         </propstat>
         </response>
-        </multistatus>'''
+        </multistatus>''' % {
+            'resource_url': resource_url,
+            'props_xml': props_xml}
 
         pfind = propfind.PROPFIND(folder, request)
 



More information about the Zope3-Checkins mailing list