[Zope3-Users] Lists dont accept default values
Frank Burkhardt
fbo2 at gmx.net
Thu Feb 16 03:55:15 EST 2006
Hi,
On Wed, Feb 15, 2006 at 06:18:48PM +0100, Florian Lindner wrote:
[snip]
> > I wrote a schema like this to have a list of objects on a content object:
> >
> > class IMyContent(Interface):
> > mynumbers=List(
> > title=_(u"Cool Numbers"),
> > required=True,
> > value_type=Int(
> > title=_("integer")
> > )
> > default=[1,2,3,5,7]
> > )
>
> I think the default property expects one item of your list, so either 1, 2, 3,
> 5 or 7, not all of them.
No it doesn't. default=1 generates this error:
ConfigurationError: ('Invalid value for', 'mynumbers', "(1, <type 'list'>)")
> If you want to define the set of selectable values you maybe rather want to
> use a Choice field and specify the values property. Or set a Choice field as
> value for value_type.
I don't really need Int as list items but some more complex objects.
This works quite well - except of the missing default.
Regards,
Frank
More information about the Zope3-users
mailing list