question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HttpRequest.META is not deprecated

See original GitHub issue

Python Version

3.8.10

Django Version

3.2

Package Version

1.0.0

Description

According to the documentation of HttpRequest.META, HttpRequest.META is not deprecated in any version of django, so the rule in django-upgrade which converts these calls to request.headers and removes the HTTP prefix looks like it is too strict.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
adamchainzcommented, Sep 23, 2021

I’ve improved the description in #73 to not only mention deprecations.

(and in this particular case, it looks like this is not an official best practice, it is not mentionned in django documentation)

For old features we’ve been historically reticent to deprecate them or recommend the new one, because of the churn. My hope is this tool helps reduce the cost of that churn so we can make more required changes.

I don’t think there’s a reasonable claim that request.META["HTTP_FOO"] is “better” in any way to request.headers["Foo"]. The old way is just terrible and unfriendly.

(My primary need here is to use a tool which makes the smaller amount of migrations in my codebase required to update the django version of my repo, at least as a first pass so that it is more digestable than a diff which would also add changes related to pretended best practices. These best practices changes could come as a second pass.)

I have sympathy for this approach but I don’t really want to complicate django-upgrade. pyupgrade takes a similar “all or nothing” approach, albeit with three special case flags.

I would add a flag if there was a potential bug or compelling reason to keep request.META, but I don’t see one. If you want to incrementally add the changes, you can always use git add --patch for your commit or filter hunks with a regex.

0reactions
quentinelwincommented, Sep 23, 2021

I’ve improved the description in #73 to not only mention deprecations.

OK thanks 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Django] #20147: Replace and deprecate request.META for HTTP ...
This leaves a few things in META that are not derived from an HTTP header, and do not have a way of accessing...
Read more >
XMLHttpRequest is deprecated. What to use instead?
Trying to use a pure JS approach to check if I have a valid JS image url. I am getting a warning that...
Read more >
Is noconnect really deprecated? https request over https proxy ...
Because when I directed the proxy url to a server I control with noconnect added, the proxy reports making a connect anyways. So...
Read more >
Content-Security-Policy - HTTP - MDN Web Docs - Mozilla
Chrome Edge Content‑Security‑Policy Full support. Chrome25. more. Toggle history Full sup... base‑uri Full support. Chrome40. Toggle history Full sup... block‑all‑mixed‑content. Deprecated Full support. ChromeYes. Toggle history...
Read more >
HttpRequest Class | Apex Reference Guide
Use the HttpRequest class to programmatically create HTTP requests like GET, ... This method is deprecated. ... If false , no compression format...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found