Re: [Zope3-Users] Lists dont accept default values
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=_(uCool 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 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Lists dont accept default values
On Feb 16, 2006, at 3:55 AM, Frank Burkhardt wrote: I wrote a schema like this to have a list of objects on a content object: class IMyContent(Interface): mynumbers=List( title=_(uCool Numbers), required=True, value_type=Int( title=_(integer) ) default=[1,2,3,5,7] ) FWIW, I just think it's a bug that this doesn't work. Have you put it in the collector? Gary ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Lists dont accept default values
Am Mittwoch, 15. Februar 2006 14:40 schrieb Frank Burkhardt: Hi, I wrote a schema like this to have a list of objects on a content object: class IMyContent(Interface): mynumbers=List( title=_(uCool 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. 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. See Stephans book [1], chapther 8.3 Core Schema Fields [1] http://www.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/FrontPage/Zope3Book Regards, Florian myline=TextLine( title=_(A line of text), required=True, default=u'default test' ) I'm using an 'addform' to add self made objects to my site but unfortunately the list mynumbers is not initialized with those 5 default numbers. The default value of myline is displayed correctly on the add form. Does anyone know, how this can be fixed? ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users