[Zope3-checkins] CVS: Zope3/src/zope/app/form - utility.py:1.8
R. David Murray
bitz@bitdance.com
Mon, 27 Jan 2003 23:07:25 -0500
Update of /cvs-repository/Zope3/src/zope/app/form
In directory cvs.zope.org:/tmp/cvs-serv17909/zope/app/form
Modified Files:
utility.py
Log Message:
setUpEditWidgets had the same issue as setUpWdigets, naturally.
Fixed the same way.
=== Zope3/src/zope/app/form/utility.py 1.7 => 1.8 ===
--- Zope3/src/zope/app/form/utility.py:1.7 Mon Jan 27 22:40:08 2003
+++ Zope3/src/zope/app/form/utility.py Mon Jan 27 23:06:53 2003
@@ -113,24 +113,24 @@
if content is None:
content = view.context
- for name in (names or schema):
- field = schema[name]
- if IField.isImplementedBy(field):
- # OK, we really got a field
- if field.readonly:
- vname = 'display'
- else:
- vname = 'edit'
+ if not names: fields = getFieldsInOrder(schema)
+ else: fields = [ (name, schema[name]) for name in names ]
- try:
- value = getattr(content, name)
- except AttributeError, v:
- if v.__class__ != AttributeError:
- raise
- value = None
+ for name, field in fields:
+ if field.readonly:
+ vname = 'display'
+ else:
+ vname = 'edit'
- setUpWidget(view, name, field, value,
- prefix = prefix, force = force, vname = vname)
+ try:
+ value = getattr(content, name)
+ except AttributeError, v:
+ if v.__class__ != AttributeError:
+ raise
+ value = None
+
+ setUpWidget(view, name, field, value,
+ prefix = prefix, force = force, vname = vname)
def haveWidgetsData(view, schema, names=None):
"""Collect the user-entered data defined by a schema