On Thursday, July 19, 2018 at 8:52:56 AM UTC+2, Carlton Gibson wrote:
>
> The usual case is to need a single value from the query string, so `[]` 
> and `get()` both return scalars. 
> `getList()` exists specifically for the case where you do want multiple 
> values. 
>

I'd like to expand on this, because the current behaviour has even more 
important aspects. The query string is supplied by the user and as such is 
completely untrusted data. If `.get` were to change to return lists if 
there are lists, this would mean that the user could control the data 
structures in the view. This is not something we'd ever want.

Aside from that it is technically impossible to change the behaviour of get 
to return lists: What would ?some_param=1 result in? Would it all of a 
sudden be a list with one item? Since there is no difference between a 
scalar value and a one item list in terms of query strings, this has to 
stay the decision of the developer. They are the only ones knowing how the 
data should look like and can handle it accordingly.

Cheers,
Florian

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/4e15b2a8-895e-4c43-9b61-5dce2759d23c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to