[Zope3-checkins]
SVN: Zope3/branches/isarsprint-dav-work/src/zope/app/dav/propfind.py
Condense the DOM code somewhat;
only store DOM Nodes in local variables when we
Martijn Pieters
mj at zopatista.com
Mon Oct 11 05:02:50 EDT 2004
Log message for revision 27942:
Condense the DOM code somewhat; only store DOM Nodes in local variables when we
are actually going to use those variables seriously.
Changed:
U Zope3/branches/isarsprint-dav-work/src/zope/app/dav/propfind.py
-=-
Modified: Zope3/branches/isarsprint-dav-work/src/zope/app/dav/propfind.py
===================================================================
--- Zope3/branches/isarsprint-dav-work/src/zope/app/dav/propfind.py 2004-10-11 08:13:03 UTC (rev 27941)
+++ Zope3/branches/isarsprint-dav-work/src/zope/app/dav/propfind.py 2004-10-11 09:02:50 UTC (rev 27942)
@@ -73,10 +73,8 @@
response.appendChild(ms)
re = response.createElement('response')
ms.appendChild(re)
- href = response.createElement('href')
- re.appendChild(href)
- r_url = response.createTextNode(resource_url)
- href.appendChild(r_url)
+ re.appendChild(response.createElement('href'))
+ re.lastChild.appendChild(response.createTextNode(resource_url))
_avail_props = {}
# List all *registered* DAV interface namespaces and their properties
@@ -102,14 +100,12 @@
avail, not_avail = self._propertyResolver(_props)
if avail:
- pstat = response.createElement('propstat')
- re.appendChild(pstat)
+ re.appendChild(response.createElement('propstat'))
prop = response.createElement('prop')
- pstat.appendChild(prop)
- status = response.createElement('status')
- pstat.appendChild(status)
- text = response.createTextNode('HTTP/1.1 200 OK')
- status.appendChild(text)
+ re.lastChild.appendChild(prop)
+ re.lastChild.appendChild(response.createElement('status'))
+ re.lastChild.lastChild.appendChild(
+ response.createTextNode('HTTP/1.1 200 OK'))
count = 0
for ns in avail.keys():
attr_name = 'a%s' % count
@@ -163,14 +159,12 @@
el.appendChild(value)
if not_avail:
- pstat = response.createElement('propstat')
- re.appendChild(pstat)
+ re.appendChild(response.createElement('propstat'))
prop = response.createElement('prop')
- pstat.appendChild(prop)
- status = response.createElement('status')
- pstat.appendChild(status)
- text = response.createTextNode('HTTP/1.1 404 Not Found')
- status.appendChild(text)
+ re.lastChild.appendChild(prop)
+ re.lastChild.appendChild(response.createElement('status'))
+ re.lastChild.lastChild.appendChild(
+ response.createTextNode('HTTP/1.1 404 Not Found'))
count = 0
for ns in not_avail.keys():
attr_name = 'a%s' % count
@@ -228,10 +222,9 @@
return _props
def _handlePropname(self, response, re, _avail_props):
- pstat = response.createElement('propstat')
- re.appendChild(pstat)
+ re.appendChild(response.createElement('propstat'))
prop = response.createElement('prop')
- pstat.appendChild(prop)
+ re.lastChild.appendChild(prop)
count = 0
for ns in _avail_props.keys():
attr_name = 'a%s' % count
@@ -243,10 +236,9 @@
prop.appendChild(el)
if ns is not None and ns != self.default_ns:
el.setAttribute('xmlns', attr_name)
- status = response.createElement('status')
- pstat.appendChild(status)
- text = response.createTextNode('HTTP/1.1 200 OK')
- status.appendChild(text)
+ re.lastChild.appendChild(response.createElement('status'))
+ re.lastChild.lastChild.appendChild(
+ response.createTextNode('HTTP/1.1 200 OK'))
def _propertyResolver(self, _props):
avail = {}
More information about the Zope3-Checkins
mailing list