Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DEP 0015 Content Type Parsing #88
base: main
Are you sure you want to change the base?
DEP 0015 Content Type Parsing #88
Changes from 1 commit
455c94f
f8ae2b2
7ca3842
12380d9
5053ebb
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I originally proposed
request.form_data
as the new lowercase name forrequest.POST
back in Ticket 32259, I’d like that we still keep that. We can’t find-and-replacerequest.POST
withrequest.data
without adding new functionality unsafely.Also, let’s list the renames right here in the abstract, so they’re easy for future readers to find:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
form_data
is confusing.In the first place, GET forms are a thing. But once you're parsing other content types from the body, there's no form even in play at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
post_form_data
? I would just like another lowercase name for the existing attribute so it’s not left uppercase-only, requiring users to adoptdata
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, you mean as well as then adding the
data
attribute? I'd misunderstood.OK, yes, something like that makes sense.
Let's discuss in Vigo, where we can likely bikeshed it to death over less than a single coffee ☕️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having spoken with @adamchainz at DjangoCon, I agree with him. Adding
form_data
as an alias toPOST
, maintaining the existing behaviour is a good idea. 👍There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case could this DEP become just about renaming?
That would allow django/django#17546 to make progress without this?
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My honest take is that we need both. I don't think renaming things without adding anything is great, and just sticking the
data
object on without updating the request seems an error.But, logically, yes, maybe. One strategy would be to plough on and see where we get.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@carltongibson @adamchainz any chance you remember that discussion and can recap it here? I share your original reservations about
form_data
. If someone learns Django while building an API, that's going to be confusing. Is the reason we're avoiding naming this something closer to the HTTP spec because we'll havedata
and we're trying to avoid confusion between those?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tim-schilling I think this is the key point:
The new
.data
attribute isn't behaviourally neutral. We need a safe migration path for existing code.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can also add a note that django-upgrade could automate refactoring code to use the new lowercased attributes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initial work showing this is possible: smithdc1/django-upgrade@c043761