[Zope3-checkins] CVS: Zope3/src/zope/app/dav - propfind.py:1.10
Jim Fulton
jim@zope.com
Thu, 5 Jun 2003 16:13:39 -0400
Update of /cvs-repository/Zope3/src/zope/app/dav
In directory cvs.zope.org:/tmp/cvs-serv24717/src/zope/app/dav
Modified Files:
propfind.py
Log Message:
Changed the way widgets are created and stored in forms.
Widgets (views on fields) were stored in attributes with the same
names as the fields. This led to conflicts with other view attribute
names in some cases. Now widgets are stored in attributes with names
equal to the field name with an added suffix of '_widget'. For
example, the widget for a title field is named "title_widget".
=== Zope3/src/zope/app/dav/propfind.py 1.9 => 1.10 ===
--- Zope3/src/zope/app/dav/propfind.py:1.9 Tue Jun 3 18:46:19 2003
+++ Zope3/src/zope/app/dav/propfind.py Thu Jun 5 16:13:08 2003
@@ -106,7 +106,8 @@
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))
+ initial = getWidgetsDataFromAdapter(
+ adapter, iface, names=avail.get(ns))
setUpWidgets(self, iface, initial=initial, \
names=avail.get(ns), force=True)
for p in avail.get(ns):
@@ -114,17 +115,19 @@
if ns is not None and ns != self.default_ns:
el.setAttribute('xmlns', attr_name)
prop.appendChild(el)
- value = getattr(self, p)()
+ value = getattr(self, p+'_widget')()
if isinstance(value, (unicode, str)):
- value = response.createTextNode(value) ## Get the widget value here
+ # Get the widget value here
+ value = response.createTextNode(value)
el.appendChild(value)
else:
if isinstance(removeAllProxies(value), minidom.Node):
el.appendChild(removeAllProxies(value))
else:
# Try to string-ify
- value = str(getattr(self, p))
- value = response.createTextNode(value) ## Get the widget value here
+ value = str(getattr(self, p+'_widget'))
+ # Get the widget value here
+ value = response.createTextNode(value)
el.appendChild(value)
if not_avail:
@@ -170,7 +173,8 @@
pfind.setDepth(subdepth)
value = pfind.PROPFIND()
parsed = minidom.parseString(value)
- responses = parsed.getElementsByTagNameNS(self.default_ns, 'response')
+ responses = parsed.getElementsByTagNameNS(
+ self.default_ns, 'response')
for r in responses:
ms.appendChild(r)