Hi all,

I've got a really frustrating problem which I'm hoping someone
familiar with FormEncode in Pylons can shed some light on.

A few weeks ago I added a form to my project which includes multiple
selects.   The form data is validated by a validate decorator using a
FormEncode schema with ForEach validators for the multiple fields.
This all worked fine, and when there were errors the multiple values
were correctly selected on error page.

At some point something changed, and I started only ever getting a
single value for the multiple fields.  I still can't work out what
changed.  I managed to get multiple values working again by setting
variable_decode=True in the decorator, but but if an error occurs only
one item from each multiple item is selected in the redrawn form.

Reading the source and using the debugger, it appears that:

paste.request.parse_formvars writes a MultiDict with repeating keys to
environ['paste.parsed_formvars']
The validate decorator just passes on the request vars unless
variable_decode is set
Schema._to_python iterates over each item in the dict
The ForEach validator expects a list for each value

It seems that at some point getall() needs to be called on the
MultiDict, but I can't see where.  Any ideas what I am (now!) doing
wrong?

Many thanks,

Graham


--~--~---------~--~----~------------~-------~--~----~
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