[Zope3-checkins] CVS: Zope3/src/zope/app/dav - configure.zcml:1.5 propfind.py:1.2

Sidnei da Silva sidnei@x3ng.com.br
Wed, 21 May 2003 13:27:08 -0400


Update of /cvs-repository/Zope3/src/zope/app/dav
In directory cvs.zope.org:/tmp/cvs-serv29504/src/zope/app/dav

Modified Files:
	configure.zcml propfind.py 
Log Message:
More tests for PROPFIND. General whitespace cleaning

=== Zope3/src/zope/app/dav/configure.zcml 1.4 => 1.5 ===
--- Zope3/src/zope/app/dav/configure.zcml:1.4	Wed May 21 12:10:06 2003
+++ Zope3/src/zope/app/dav/configure.zcml	Wed May 21 13:26:37 2003
@@ -19,6 +19,24 @@
        allowed_attributes="getData haveData setData __call__"
        />
 
+ <defaultView
+       for="zope.schema.interfaces.ITextLine"
+       name="view"
+       permission="zope.Public"
+       type="zope.publisher.interfaces.http.IHTTPPresentation"
+       factory="zope.app.dav.widget.SimpleDAVWidget"
+       allowed_attributes="getData haveData setData __call__"
+       />
+
+ <defaultView
+       for="zope.schema.interfaces.IDatetime"
+       name="view"
+       permission="zope.Public"
+       type="zope.publisher.interfaces.http.IHTTPPresentation"
+       factory="zope.app.dav.widget.SimpleDAVWidget"
+       allowed_attributes="getData haveData setData __call__"
+       />
+
  <adapter
       provides="zope.app.interfaces.dav.IDAVSchema"
       for="*"


=== Zope3/src/zope/app/dav/propfind.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/dav/propfind.py:1.1	Wed May 21 12:10:06 2003
+++ Zope3/src/zope/app/dav/propfind.py	Wed May 21 13:26:37 2003
@@ -97,7 +97,12 @@
             pstat.appendChild(status)
             text = response.createTextNode('HTTP/1.1 200 OK')
             status.appendChild(text)
+            count = 0
             for ns in avail.keys():
+                attr_name = 'a%s' % count
+                if ns is not None and ns != self.default_ns:
+                    count += 1
+                    prop.setAttribute('xmlns:%s' % attr_name, ns)
                 iface = _props[ns]['iface']
                 adapter = queryAdapter(self.context, iface, None)
                 initial = getWidgetsDataFromAdapter(adapter, iface, names=avail.get(ns))
@@ -106,7 +111,7 @@
                 for p in avail.get(ns):
                     el = response.createElement('%s' % p )
                     if ns is not None and ns != self.default_ns:
-                        el.setAttribute('xmlns', ns)
+                        el.setAttribute('xmlns', attr_name)
                     prop.appendChild(el)
                     value = getattr(self, p)()
                     if isinstance(value, (unicode, str)):
@@ -116,7 +121,10 @@
                         if isinstance(removeAllProxies(value), minidom.Node):
                             el.appendChild(removeAllProxies(value))
                         else:
-                            raise TypeError('Value should be string or minidom.Node. Got %r' % type(value))
+                            # Try to string-ify
+                            value = str(getattr(self, p))
+                            value = response.createTextNode(value) ## Get the widget value here
+                            el.appendChild(value)
 
         if not_avail:
             pstat = response.createElement('propstat')
@@ -127,12 +135,17 @@
             pstat.appendChild(status)
             text = response.createTextNode('HTTP/1.1 403 Forbidden')
             status.appendChild(text)
+            count = 0
             for ns in not_avail.keys():
+                attr_name = 'a%s' % count
+                if ns is not None and ns != self.default_ns:
+                    count += 1
+                    prop.setAttribute('xmlns:%s' % attr_name, ns)
                 for p in not_avail.get(ns):
                     el = response.createElement('%s' % p )
                     prop.appendChild(el)
                     if ns is not None and ns != self.default_ns:
-                        el.setAttribute('xmlns', ns)
+                        el.setAttribute('xmlns', attr_name)
 
         self._depthRecurse(ms)