[Zope3-Users] Lists dont accept default values
Shaun Cutts
shaun at cuttshome.net
Wed Feb 15 13:38:10 EST 2006
Frank,
I'm not sure how widgets manage to get default values; I know that
zope.schema itself doesn't set them.
There is further problem with the design for "default" -- see discussion
of "default_factory" on zope3-dev: basically, even if the widget were to
get this default, it would be *the* list for every implementation of
IMyContent (not *a* list with these default values). Maybe for this very
reason the widget ignores the default.
Ideally (in my opinion) there would be a default_factory attribute for
mutable schema objects, and spec of the list would be:
default_factory = lambda : list( ( 1,2,3,5,7 ) ) # new every time,
right?
That said, if these defaults are taken out of a finite universe then
Florian's response is correct.
- Shaun
More information about the Zope3-users
mailing list