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

Jim Fulton jim@zope.com
Thu, 19 Dec 2002 14:50:00 -0500


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

Modified Files:
	Utility.py 
Log Message:
  revision 1.7.2.1
  date: 2002/12/12 15:37:49;  author: jim;  state: Exp;  lines: +9 -2
  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.8 ===
--- 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 19 14:50:00 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):