On Tue, 2008-11-25 at 12:51 +0100, Thomas Guettler wrote:
> Russell Keith-Magee schrieb:
> > On Tue, Nov 25, 2008 at 7:21 PM, Thomas Guettler <[EMAIL PROTECTED]> wrote:
> >   
> >> Hi,
> >>
> >> If GET or POST contain a list, I only see the last value in the debug view.
> >>
> >> What do you see on an uncaught excepion with e.g. "?foo=1&foo=2" as
> >> query string?
> >>     
> >
> > It depends on how you try to access the values. request.GET and
> > request.POST aren't normal dictionaries - they are QueryDicts.
> Yes, I know QueryDicts. But why are they are not displayed as lists
> in the debug view?

Because the debug view displays request.GET.items and when a
MultiValueDict is dealt with using normal dictionary methods, it only
returns the last item in the list. This is documented behaviour once you
know you're dealing with a MultiValueDict. Given how relatively rare
multiple parameters with the same name are, this isn't unreasonable
default behaviour.

What to do on the debug page is a bit of a toss up. Iterating over the
keys and calling getlist() for each one isn't something you can do from
the template (since passing the arg to getlist() isn't possible). So we
either have to add a method to the data structure just for the debug
page or write a tag or something else (maybe just leave it alone). If
there's a neat enough way to list all the values, it'd be worth doing, I
guess.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" 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/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to