[Zope3-Users] z3c.form: LookupErrors

Martin Aspeli optilude+lists at gmail.com
Tue Apr 7 10:16:51 EDT 2009


Hi,

In z3c.form (at least with 1.9.0), if you have a Choice field and the 
vocabulary changes so that an existing value (or the default value on an 
add form) is no longer valid, you get a LookupError:

   Module z3c.form.form, line 126, in updateWidgets
   Module z3c.form.field, line 259, in update
   Module z3c.form.browser.select, line 51, in update
   Module z3c.form.browser.widget, line 61, in update
   Module z3c.form.widget, line 182, in update
   Module z3c.form.widget, line 120, in update
   Module z3c.form.converter, line 258, in toWidgetValue
   Module z3c.form.term, line 31, in getTerm
   Module zope.schema.vocabulary, line 124, in getTerm

It'd be nicer if z3c.form would catch the error and return 
field.missing_value or something like that. As it stands, if this 
happens with a content object, it's impossible to reach the edit form 
and fix the value!

Martin

-- 
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book



More information about the Zope3-users mailing list