[Zope3-Users] z3c.form: LookupErrors

Roger Ineichen dev at projekt01.ch
Tue Apr 7 14:39:41 EDT 2009


Hi Stephan

> -----Ursprüngliche Nachricht-----
> Von: Stephan Richter [mailto:srichter at cosmos.phy.tufts.edu] 
> Gesendet: Dienstag, 7. April 2009 19:30
> An: zope3-users at zope.org; dev at projekt01.ch
> Cc: 'Martin Aspeli'
> Betreff: Re: [Zope3-Users] z3c.form: LookupErrors
> 
> On Tuesday 07 April 2009, Roger Ineichen wrote:
> > > 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.
> 
> No, it is not. The legacy data problem is a special case.
> 
> What if your list of choices depends on constantly changing 
> data? For example, a widget allows you to select a user from 
> a userfolder. Later the user gets deleted. 

pang, legacy data created

> Just because you 
> selected the user before, the form should not fail.

and the question is, do you cleanup legacy data or not

> I totally agree with Martin that we should use missing_value 
> in those cases.

Defently not. Such forms will show you a default value and you
think this is Ok. But the object devliers still the old
stored value. Pang, pang and you will be surprised till you 
will start debugging and see the real value decorated within the
missing_value. That's a horrible scenario!

> I think this could actually be considered a fairly serious bug.

No, defently not, the Choice field defines what are valid values
and the widget only handels that. There is no reason why a widget
should do more then that.

If you remove valid values for a field, you also have to make
sure that the system doesn't use them. Doesn't matter if a 
system can work with different/legacy data or not.

I think you are right that a valid missing_value should get
used, but that must be implemented at the field level. The 
field has to return that missing_value. This will make sure
that objects value returns the same as the widget does.

But that's a kind of auto-mirgation for legacy data.
And I'm not sure if this is a good idea.

Regards
Roger Ineichen

> Regards,
> Stephan
> --
> Stephan Richter
> Web Software Design, Development and Training Google me. 
> "Zope Stephan Richter"
> 



More information about the Zope3-users mailing list