Re: Rename request.GET and POST, and lowercase COOKIES, FILES, and META

2020-12-11 Thread Adam Johnson
I finally got around to creating a ticket: https://code.djangoproject.com/ticket/32259#ticket On Sat, 9 May 2020 at 18:03, Tobias McNulty wrote: > Tim your point is well made. I'm left with the feeling that an imperfect > convention is really not so bad, and possibly not worth the huge number o

Re: Rename request.GET and POST, and lowercase COOKIES, FILES, and META

2020-05-09 Thread Tobias McNulty
Tim your point is well made. I'm left with the feeling that an imperfect convention is really not so bad, and possibly not worth the huge number of global developer hours it would cost to effect such a change. Plus (I make this argument mostly in jest), the new names, because they are more Python

Re: Rename request.GET and POST, and lowercase COOKIES, FILES, and META

2020-05-09 Thread Tim Allen
I'm tentatively +1 on this change... but... While it may be a straightforward operation to do a case sensitive search and replace in most code bases, it is not trivial to do so on the rest of the web. If we're going to do this, we must realize that this will invalidate thousands of examples, tu

Re: Rename request.GET and POST, and lowercase COOKIES, FILES, and META

2020-05-09 Thread Florian Apolloner
On Saturday, May 9, 2020 at 1:41:41 PM UTC+2, Aymeric Augustin wrote: > > - Users who don't know that GET queries mustn't have side effects and who > don't want to bother will have an incentive to use a POST query to get the > data in form_data; this is the safe option with regards to CSRF; >

Re: Rename request.GET and POST, and lowercase COOKIES, FILES, and META

2020-05-09 Thread Aymeric Augustin
Hello, This is quite disruptive — says the guy who suggested to remove request.REQUEST a few years back — but I think we could go ahead and do it. The names proposed by Adam are good. I read the concerns about (e.g. for search forms) where form data ends up in query_params and not form_data.

Re: Rename request.GET and POST, and lowercase COOKIES, FILES, and META

2020-05-08 Thread Ryan Hiebert
It seems that many of the people who want a different name are not understanding that this name is going to be exclusively for dealing with POST forms that are using the standard `x-www-form-urlencoded` media type*, *and won't be attempting to interpret any other media type. Some generic names, lik

Re: Rename request.GET and POST, and lowercase COOKIES, FILES, and META

2020-05-08 Thread Carlton Gibson
> On 7 May 2020, at 22:03, Florian Apolloner wrote: > > forms with method="GET" are legitimate and wouldn't end up in `form_data` > forms with method="GET" are legitimate and wouldn't end up in `form_data` > which is imo quite confusing. Do we have any other options? Would there be an issue

Re: Rename request.GET and POST, and lowercase COOKIES, FILES, and META

2020-05-08 Thread Fran Hrženjak
On Wed, 6 May 2020 at 17:49, Adam Johnson wrote: > +1 request.data >> >> We shouldn’t be POSTists, there is also PUT and PATCH. >> > > Would just like to point out - that's not the proposal. The proposal is to > rename the existing request.POST to request.form_data, which is based on > parsing ap

Re: Rename request.GET and POST, and lowercase COOKIES, FILES, and META

2020-05-07 Thread Florian Apolloner
On Wednesday, May 6, 2020 at 5:49:40 PM UTC+2, Adam Johnson wrote: > > Would just like to point out - that's not the proposal. The proposal is to > rename the existing request.POST to request.form_data, which is based on > parsing application/x-www-form-urlencoded data from request.body. Browse

Re: Rename request.GET and POST, and lowercase COOKIES, FILES, and META

2020-05-06 Thread Adam Johnson
> > +1 request.data > > We shouldn’t be POSTists, there is also PUT and PATCH. > Would just like to point out - that's not the proposal. The proposal is to rename the existing request.POST to request.form_data, which is based on parsing application/x-www-form-urlencoded data from request.body. Bro

Re: Rename request.GET and POST, and lowercase COOKIES, FILES, and META

2020-05-06 Thread Fran Hrženjak
+1 request.query_params If request.method == "POST": thing = request.GET.get("thing") That’s just silly. +1 request.data We shouldn’t be POSTists, there is also PUT and PATCH. And apparently GET requests can also have a body: https://stackoverflow.com/questions/978061/http-get-with-reque

Re: Rename request.GET and POST, and lowercase COOKIES, FILES, and META

2020-05-06 Thread אורי
Hi, I also prefer lowercase names since uppercase is usually reserved for constants in Python. The names of the requests ("GET" / "POST") can be used in strings to check the request method (uppercase). But there is no sense in using uppercase names for variables. אורי u...@speedy.net On Wed, May

Re: Rename request.GET and POST, and lowercase COOKIES, FILES, and META

2020-05-06 Thread Riccardo Magliocchetti
Hello, On 05/05/20 23:26, Adam Johnson wrote: request.GET and request.POST are misleadingly named: - GET contains the URL parameters and is therefore available whatever the request method. This often confuses beginners and “returners” alike. - POST contains form data on POST request

Re: Rename request.GET and POST, and lowercase COOKIES, FILES, and META

2020-05-06 Thread Ryan Hiebert
I can agree that there might be better things to do, but this falls into the category of warts for me, so I'm +1. Having the name be pythonic is a plus, but avoiding a beginner footgun is better. And I believe the conventions used did indeed come from PHP. There even used to be a parallel to `$_RE

Re: Rename request.GET and POST, and lowercase COOKIES, FILES, and META

2020-05-06 Thread Tom Carrick
> This often confuses beginners and “returners” alike. I'm neither a beginner nor returner and I still have to remind myself that request.POST doesn't contain my JSON data. I think it's a positive change. I agree there are things that would provide a better ROI, but people have to be willing to d

Re: Rename request.GET and POST, and lowercase COOKIES, FILES, and META

2020-05-06 Thread Steven Mapes
Ah yes that's true, totally forgot about request.body just then even though I was using it a few days ago. So yes renaming it would help in that regard as I do remember seeing a few S/O question where it's confused people in the past. Mr Steven Mapes Software Development and Solutions E: st...@

Re: Rename request.GET and POST, and lowercase COOKIES, FILES, and META

2020-05-06 Thread Adam Johnson
> > I always took the capitalisation of GET &co to come from HTTP > — I'd say that's where PHP > took it from too but 🤷‍♀️ > Yes GET and POST are capitalized in HTTP, but then COOKIES is not (Set-Cookie / Cookies headers), and FILES and META aren't dir

Re: Rename request.GET and POST, and lowercase COOKIES, FILES, and META

2020-05-06 Thread Steven Mapes
Combined them would be very very bad and you would have the same problems as with $_REQUEST in PHP where you have to decide which one wins as you can make a POST to a URL with querystring where one of the parameters uses the same name as a element of the POST and but where the value is different

Re: Rename request.GET and POST, and lowercase COOKIES, FILES, and META

2020-05-06 Thread Steven Mapes
I also thought it was a taken more form HTTP rather than PHP but if this is changed please do not use *request.form_data* as that is also misleading as you can POST many more sources than form data such as with APIs. post_data would be much clearer. On Tuesday, 5 May 2020 22:26:34 UTC+1, Adam J

Re: Rename request.GET and POST, and lowercase COOKIES, FILES, and META

2020-05-06 Thread Raffaele Salmaso
For me it's a good move (the best would be to have request.data as with DRF). I've done this kind of "upgrade" from Django request.{GET,POST} to DRF request.{query_params,data} and it was quite trivial (search and replace). At the same time it forced me to check the code for correctnes, and I found

Re: Rename request.GET and POST, and lowercase COOKIES, FILES, and META

2020-05-06 Thread Jure Erznožnik
I agree. If anything, I've always had issues with GET & POST being different entities in the first place, but never with their names. I would really like to see an entity combining both of them. THAT one, maybe the preferred way of doing so, would be lowercase, but RAW representations of incomi

Re: Rename request.GET and POST, and lowercase COOKIES, FILES, and META

2020-05-05 Thread Carlton Gibson
Hmmm. I have to say I think there are areas where we could get a better ROI on our time than this. I always took the capitalisation of GET &co to come from HTTP — I'd say that's where PHP took it from too but 🤷‍♀️ That they're a bit "unpythonic" (M

Rename request.GET and POST, and lowercase COOKIES, FILES, and META

2020-05-05 Thread Adam Johnson
request.GET and request.POST are misleadingly named: - GET contains the URL parameters and is therefore available whatever the request method. This often confuses beginners and “returners” alike. - POST contains form data on POST requests, but not other kinds of data from POST requests