What's the right Colander node for a multiselect form field? I'm using
Colander with 'smallform' in a Pyramid application. I want a list of
strings, possibly empty, from a constrained set of choices.
SchemaNode(List(), validator=ContainsOnly([...]))
says a correct string value is invalid because it's "not iterable".
I'm now trying a SequenceSchema class with a string SchemaNode:
class PostTag(SequenceSchema):
tag = SchemaNode(String), validator=OneOf([...])
But how do I indicate that it's optional, and that I want the missing
value to be an empty list rather than None? Also, while it's nice that
I can validate the type of each element this way, it's overkill for
strings, and I can't use the nice ContainsOnly that sounds like it's
what I want.
--
Mike Orr <[email protected]>
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.