Thanks a lot, that worked. I added this use-case as a comment to the how-to on the doc site.<br><br><div class="gmail_quote">On Thu, Apr 30, 2009 at 6:45 PM, Douglas Cerna <span dir="ltr"><<a href="mailto:douglascerna@yahoo.com">douglascerna@yahoo.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Have you tried something like this:<br>
<br>
class IFoo(Interface):<br>
<br>
foos = schema.List(<br>
title=u"Foos",<br>
value_type=schema.Choice(title=u"Foo", source=YourSource())<br>
)<br>
<br>
<br>
This specifies that the "foos" attribute will be a list that only can contain values retrieved from the source.<br>
<br>
Hope this helps.<br>
<br>
Douglas<br>
<br>
"... allí es cuando te das cuenta que las cosas malas pueden resultar bastante buenas..." - Lionel Messi<br>
<br>
Por favor, evite enviarme adjuntos de Word, Excel o PowerPoint.<br>
Vea <a href="http://www.gnu.org/philosophy/no-word-attachments.es.html" target="_blank">http://www.gnu.org/philosophy/no-word-attachments.es.html</a><br>
<br>
<br>
--- On Thu, 4/30/09, Thibaud Morel l'Horset <<a href="mailto:teebes@gmail.com">teebes@gmail.com</a>> wrote:<br>
<br>
> From: Thibaud Morel l'Horset <<a href="mailto:teebes@gmail.com">teebes@gmail.com</a>><br>
> Subject: [Grok-dev] Using zc.sourcefactory.basic.BasicSourceFactory for a schema.List<br>
> To: "Grok" <<a href="mailto:grok-dev@zope.org">grok-dev@zope.org</a>><br>
> Date: Thursday, April 30, 2009, 1:28 PM<br>
<div><div></div><div class="h5">> Is there a way to specify a source to a schema.List?<br>
><br>
> I went through the form source tutorial at<br>
> <a href="http://grok.zope.org/documentation/how-to/using-sources-in-your-forms" target="_blank">http://grok.zope.org/documentation/how-to/using-sources-in-your-forms</a><br>
> but<br>
> while that works great for schema.Choice, I get the<br>
> following error when<br>
> trying to use it with a List:<br>
><br>
> ZopeXMLConfigurationError: File<br>
> "/Users/thibaud/grok/scs/src/scs/configure.zcml",<br>
> line 5.2-5.27<br>
> TypeError: __init__() got an unexpected keyword<br>
> argument 'source'<br>
><br>
> Is there no way to do this?<br>
><br>
> Thanks,<br>
><br>
> Thibaud<br>
</div></div>> _______________________________________________<br>
> Grok-dev mailing list<br>
> <a href="mailto:Grok-dev@zope.org">Grok-dev@zope.org</a><br>
> <a href="http://mail.zope.org/mailman/listinfo/grok-dev" target="_blank">http://mail.zope.org/mailman/listinfo/grok-dev</a><br>
<br>
<br>
<br>
<br>
</blockquote></div><br>