Friday, March 27, 2015

Re: QueryDict and its .dict() method - why does it do that?

Thanks for kind answers guys.

Best Regards


On Fri, Mar 27, 2015, 5:31 PM Simon Charette <charette.s@gmail.com> wrote:
Hi Gabriel,

One thing I dislike about how PHP/Rail deal with this is the fact they expose an easy way to shoot yourself in the foot.

e.g. PHP

Your code expects $_GET['foo'] to be an array() but the querystring is missing the trailing "[]" (?foo=bar) and crash. This also open a door for subtle attack vectors, let's not forget that those implementation assumes a parameter to be a collection or not based on user submitted data.

I strongly prefer how Django forces you to explicitly declare you're expecting to retrieve a collection from a specific parameter.

Simon


Le vendredi 27 mars 2015 16:10:05 UTC-4, Gabriel Pugliese a écrit :
Hi Carl,

I perfectly understand what you are saying. It was very clear and informative, but do not agree with the design chosen here. Below is just an opinion and you do not have to agree with it:

My buddies have given PHP and Rails examples, but there are other frameworks from other languages that do that the same way. I mean, what's the advantage here doing differently from others?
And I don't agree it follows KISS if I need to re-iterate on the result again to get a dict from it (one clear example usage is destructuring as named function parameters).

Thanks again!

On Thursday, March 26, 2015 at 2:52:48 PM UTC-3, Gabriel Pugliese wrote:
This gist is self informative - some information from list is lost: https://gist.github.com/gabrielhpugliese/640b69eefc5b7490a07c

Some of my buddies have pasted Rails(Rack) and PHP conversion right below. Is that something I am missing? Does it have to do with laziness?

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/m3U7gfhWs2g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/28c33760-d9cf-4966-a249-aa1ab607909d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CADqmskvsuBbeZa5NKHguwni9jsN2EnPH2JAzOMmx81wOaa%2BZ%3DQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment