On Monday 07 July 2008 06:14:08 Mark Ramm wrote:
> It seems that some folks were actually using the feature of CherryPy
> which turned ?name=Edu&name=Roger&name=Mark into a
> name=['Roger','Mark] parameter.
>
> I tend to think this feature is a little bit strange because if for
> some reason I only wanted to pass up name=Mark I'd get a string not a
> list as the name param.
>
> In TG2 we're just passing along name="Roger" in the above case but
> other name elements are available from the request.GET multidict:
>
> http://pythonpaste.org/webob/index.html#multidict
>
> So you could do:
>
> request.GET.getall('name')
>
> Which will return the list ('Roger', 'Mark) and will *always* return a
> tuple, so there's no ambiguity.
>
> TG2 could add a "compatibility mode" that makes these things happen,
> or we could use a decorator to give us a more backwards compatible way
> of working, but I rather like the fact that I can predict what I'm
> getting the current way, so I'm a bit hesitant to go too far down that
> road without some more significant feedback from users.
>
> Any thoughts?

This is an HTTP-wart we unfortunately have to live with.

ZOPE introduces name-prefices such as "list:name" to declare "name" as being a 
list.

J2EE solved the problem by returning an array of strings for parameters at 
some point, regardless of the number of times it appears.

If *anything* I would recommend that as solution, albeit I see that it is a 
bit ugly in many cases where one *knows* that there is only one value to 
expect.

However I totally disagree with the proposed solution of passing only one 
parameter value!!! This opens up a whole can of worms. It will introduce 
subtle errors that stem from re-ordered input fields in HTML-forms as well as 
browser and HTTP-request-parsing implementations.

The best way IMHO would be to allow for easy declaration of a names that are 
supposed to be lists under all circumstances. In Formencode, one can do so 
using the ForEach(as_list=True) (or something very similar) validator. Maybe 
a declarative decorator to do so would be good.

Diez

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" 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/turbogears-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to