[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/Forms - Utility.py:1.7.2.1

Jim Fulton jim@zope.com
Thu, 12 Dec 2002 10:37:50 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/Forms
In directory cvs.zope.org:/tmp/cvs-serv25789/lib/python/Zope/App/Forms

Modified Files:
      Tag: AdapterAndView-branch
	Utility.py 
Log Message:
Fixed a bug that caused forbidden attribute errors to be masked when
building edit forms.


=== Zope3/lib/python/Zope/App/Forms/Utility.py 1.7 => 1.7.2.1 ===
--- Zope3/lib/python/Zope/App/Forms/Utility.py:1.7	Wed Dec 11 08:57:31 2002
+++ Zope3/lib/python/Zope/App/Forms/Utility.py	Thu Dec 12 10:37:49 2002
@@ -131,8 +131,15 @@
                 vname = 'display'
             else:
                 vname = 'edit'
+
+            try:
+                value = getattr(content, name)
+            except AttributeError, v:
+                if v.__class__ != AttributeError:
+                    raise
+                value = None
                 
-            setUpWidget(view, name, field, getattr(content, name, None),
+            setUpWidget(view, name, field, value,
                         prefix = prefix, force = force, vname = vname)
 
 def haveWidgetsData(view, schema, names=None):