[Zope3-Users] z3c.form: LookupErrors
Roger Ineichen
dev at projekt01.ch
Tue Apr 7 12:29:21 EDT 2009
Hi Martin
> -----Ursprüngliche Nachricht-----
> Von: zope3-users-bounces at zope.org
> [mailto:zope3-users-bounces at zope.org] Im Auftrag von Martin Aspeli
> Gesendet: Dienstag, 7. April 2009 16:17
> An: zope3-users at zope.org
> Betreff: [Zope3-Users] z3c.form: LookupErrors
>
> 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!
This is a legacy data problem. Such data need to get migrated
by a generation if a value is no longer valid.
Otherwise the wrong (not valid) value is still used in the app.
It doesn't make sense to just skip invalid values and fallback
to missing_value in the vocabulary widget since this value get
used by everthing else then the widget.
But probably if legacy data are not a problem in some apps,
we should implement a vocabulary and widget which can handle
such legacy data problems or make it a configurable option.
I also was thinking about a widget which allows to define
depreated values which are valid but not shown for selecting.
this whould allow to skip values fer a future selection.
Probably this whould require a enhanced vocabulary implementation
which offers a deprecated value list or something like that.
What do you think? Whould this fit for you?
Regards
Roger Ineichen
> Martin
>
> --
> Author of `Professional Plone Development`, a book for
> developers who want to work with Plone. See
> http://martinaspeli.net/plone-book
>
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
>
More information about the Zope3-users
mailing list