On Jan 26, 2:33 am, eleith <[email protected]> wrote:
> for my schema, i want to handle
> ----------------------------------------
> delete?id=100
> delete?id=100&id=101&id=102
>
> and throw an error for
>
> delete?
> -----------------------------------------
> my validators look like this:
>
> id = ForEach(Int(), not_empty=True, convert_to_list=True)
>
> however, this passes when even when i don't pass in an 'id'
>
> i've even tried
>
> All(NotEmpty(), ForEach(....))
>
> that doesn't work either. i've ended up writing my own function and
> subclassing into SimpleFormValidator to handle this case for me (i
> just check if the len(values['id']) < 1, and return an error message)
>
> so either i'm going about this the wrong way, or there is an error in
> ForEach and/or All.
>
> any suggestions? (although, i'm happy with my solution, just thought i
> would publish my findings)

Have you seen the Pipe compound validator? I haven't used it, but I
wonder it if might work for this.

After taking a peek at the source[1], this might work, too:

    ForEach(NotEmpty(), Int())

[1] http://www.formencode.org/formencode/foreach.py.html?f=15&l=126#15
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to