|
From: Igor M. <dow...@gm...> - 2006-01-03 06:40:06
|
Hello everyone,
I am trying to validate a really simple form, something like this:
{ 'names' : ['James', 'Book'], 'zips':['12345', '20093'],
'id':'5', 'misc':'foo'] }
for a method like processForm(names, zips, id, misc)
However, while making a schema for id and misc is simple (using
validators.Int() and validators.String()), I have hit a dead end when
looking for a way to validate a *list* of integers or a list of
strings.
According to the FormEncode documentation,
http://www.formencode.org/module-formencode.foreach.html,
ForEach(AsInt(), InList([1, 2, 3])) would validate the [1,2,3] as a
list of integers. However I cannot find AsInt() or InList() definitions
*anywhere* in formencode package or in all of turbogears for that
matter (yes, I grepped it).
I know there is a way of writing custom validators, but I don't think
that's pythonic or even correct at all. It would be like
copying-and-pasting every time I needed to validate a list. There's got
to be an existing way to validate lists of something, right?
Thanks,
Igor
|