[Grok-dev] Using zc.sourcefactory.basic.BasicSourceFactory for a schema.List

Douglas Cerna douglascerna at yahoo.com
Thu Apr 30 18:45:02 EDT 2009


Have you tried something like this:

class IFoo(Interface):

    foos = schema.List(
        title=u"Foos",
        value_type=schema.Choice(title=u"Foo", source=YourSource())
        )


This specifies that the "foos" attribute will be a list that only can contain values retrieved from the source.

Hope this helps.

Douglas

"... allí­ es cuando te das cuenta que las cosas malas pueden resultar bastante buenas..." - Lionel Messi

Por favor, evite enviarme adjuntos de Word, Excel o PowerPoint.
Vea http://www.gnu.org/philosophy/no-word-attachments.es.html


--- On Thu, 4/30/09, Thibaud Morel l'Horset <teebes at gmail.com> wrote:

> From: Thibaud Morel l'Horset <teebes at gmail.com>
> Subject: [Grok-dev] Using zc.sourcefactory.basic.BasicSourceFactory for a schema.List
> To: "Grok" <grok-dev at zope.org>
> Date: Thursday, April 30, 2009, 1:28 PM
> Is there a way to specify a source to a schema.List?
> 
> I went through the form source tutorial at
> http://grok.zope.org/documentation/how-to/using-sources-in-your-forms
> but
> while that works great for schema.Choice, I get the
> following error when
> trying to use it with a List:
> 
> ZopeXMLConfigurationError: File
> "/Users/thibaud/grok/scs/src/scs/configure.zcml",
> line 5.2-5.27
>     TypeError: __init__() got an unexpected keyword
> argument 'source'
> 
> Is there no way to do this?
> 
> Thanks,
> 
> Thibaud
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> http://mail.zope.org/mailman/listinfo/grok-dev


      



More information about the Grok-dev mailing list