[Zope-CVS] CVS: Packages/Moztop/moztopsupport/dav - propfind.py:1.9
Sidnei da Silva
sidnei@x3ng.com.br
Sat, 29 Mar 2003 15:16:33 -0500
Update of /cvs-repository/Packages/Moztop/moztopsupport/dav
In directory cvs.zope.org:/tmp/cvs-serv18014/dav
Modified Files:
propfind.py
Log Message:
Improved PROPFIND a bit by adding allprop. Registering a few other types for PUT, to make ev happy.
=== Packages/Moztop/moztopsupport/dav/propfind.py 1.8 => 1.9 ===
--- Packages/Moztop/moztopsupport/dav/propfind.py:1.8 Sat Mar 29 12:09:54 2003
+++ Packages/Moztop/moztopsupport/dav/propfind.py Sat Mar 29 15:16:02 2003
@@ -79,26 +79,34 @@
prop = response.createElementNS(default_ns, 'D:prop')
pstat.appendChild(prop)
for p in _avail_props:
- el = response.createElementNS(default_ns, 'D:%s' % p )
- prop.appendChild(el)
+ view = queryView(self.context, \
+ 'DAV%s' % p, self.request, None)
+ if view is not None:
+ el = response.createElementNS(default_ns, 'D:%s' % p )
+ prop.appendChild(el)
status = response.createElementNS(default_ns, 'D:status')
pstat.appendChild(status)
text = response.createTextNode('HTTP/1.1 200 OK')
status.appendChild(text)
+ not_avail = []
+ avail = {}
+ props_ns = {}
source = xmldoc.getElementsByTagNameNS(default_ns, 'prop')
- if not source:
- # allprop
- #return ''
- pass
+ if not source and not propname:
+ for localname in _avail_props:
+ view = queryView(self.context, \
+ 'DAV%s' % localname, self.request, None)
+ if view is None:
+ not_avail.append(localname)
+ else:
+ view = removeAllProxies(view)
+ avail[localname] = str(view)
- if source:
+ if source and not propname:
source = source[0]
childs = [e for e in source.childNodes
if e.nodeType == e.ELEMENT_NODE]
- not_avail = []
- avail = {}
- props_ns = {}
for node in childs:
localname = node.localName
props_ns[localname] = node.namespaceURI
@@ -109,41 +117,41 @@
view = removeAllProxies(view)
avail[localname] = str(view)
- if avail:
- pstat = response.createElementNS(default_ns, 'D:propstat')
- re.appendChild(pstat)
- prop = response.createElementNS(default_ns, 'D:prop')
- pstat.appendChild(prop)
- status = response.createElementNS(default_ns, 'D:status')
- pstat.appendChild(status)
- text = response.createTextNode('HTTP/1.1 200 OK')
- status.appendChild(text)
- for p in avail.keys():
- ns = props_ns.get(p, None)
- if ns is not None:
- el = response.createElementNS(ns, '%s' % p )
- el.setAttribute('xmlns', ns)
- else:
- el = response.createElementNS(default_ns, 'D:%s' % p )
- prop.appendChild(el)
- try:
- value = minidom.parseString(avail[p]).documentElement
- except:
- value = response.createTextNode(avail[p])
- el.appendChild(value)
-
- if not_avail:
- pstat = response.createElementNS(default_ns, 'D:propstat')
- re.appendChild(pstat)
- prop = response.createElementNS(default_ns, 'D:prop')
- pstat.appendChild(prop)
- status = response.createElementNS(default_ns, 'D:status')
- pstat.appendChild(status)
- text = response.createTextNode('HTTP/1.1 403 Forbidden')
- status.appendChild(text)
- for p in not_avail:
+ if avail:
+ pstat = response.createElementNS(default_ns, 'D:propstat')
+ re.appendChild(pstat)
+ prop = response.createElementNS(default_ns, 'D:prop')
+ pstat.appendChild(prop)
+ status = response.createElementNS(default_ns, 'D:status')
+ pstat.appendChild(status)
+ text = response.createTextNode('HTTP/1.1 200 OK')
+ status.appendChild(text)
+ for p in avail.keys():
+ ns = props_ns.get(p, None)
+ if ns is not None:
+ el = response.createElementNS(ns, '%s' % p )
+ el.setAttribute('xmlns', ns)
+ else:
el = response.createElementNS(default_ns, 'D:%s' % p )
- prop.appendChild(el)
+ prop.appendChild(el)
+ try:
+ value = minidom.parseString(avail[p]).documentElement
+ except:
+ value = response.createTextNode(avail[p])
+ el.appendChild(value)
+
+ if not_avail:
+ pstat = response.createElementNS(default_ns, 'D:propstat')
+ re.appendChild(pstat)
+ prop = response.createElementNS(default_ns, 'D:prop')
+ pstat.appendChild(prop)
+ status = response.createElementNS(default_ns, 'D:status')
+ pstat.appendChild(status)
+ text = response.createTextNode('HTTP/1.1 403 Forbidden')
+ status.appendChild(text)
+ for p in not_avail:
+ el = response.createElementNS(default_ns, 'D:%s' % p )
+ prop.appendChild(el)
depth = self.getDepth()
if depth == '1':