Skip to content

Remove use of deprecated request.is_ajax() #1253

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

Merged
merged 1 commit into from
May 5, 2020
Merged

Remove use of deprecated request.is_ajax() #1253

merged 1 commit into from
May 5, 2020

Conversation

jdufresne
Copy link
Contributor

The method was deprecated in upstream commit
django/django@e348ab0.

Refs #1032

@codecov
Copy link

codecov bot commented Mar 28, 2020

Codecov Report

Merging #1253 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1253   +/-   ##
=======================================
  Coverage   86.68%   86.68%           
=======================================
  Files          25       25           
  Lines        1442     1442           
  Branches      207      207           
=======================================
  Hits         1250     1250           
  Misses        140      140           
  Partials       52       52
Impacted Files Coverage Δ
debug_toolbar/middleware.py 90.47% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bad48b2...2ebf47d. Read the comment docs.

@codecov
Copy link

codecov bot commented Mar 28, 2020

Codecov Report

Merging #1253 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1253   +/-   ##
=======================================
  Coverage   86.54%   86.55%           
=======================================
  Files          25       25           
  Lines        1442     1443    +1     
  Branches      207      207           
=======================================
+ Hits         1248     1249    +1     
  Misses        141      141           
  Partials       53       53           
Impacted Files Coverage Δ
debug_toolbar/middleware.py 90.62% <100.00%> (+0.14%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e9724cf...0672df7. Read the comment docs.

@tim-schilling
Copy link
Member

tim-schilling commented Mar 28, 2020 via email

@jdufresne
Copy link
Contributor Author

Good point.

I've updated the change to use the new request.accepts(). Let me know what you think.

@jdufresne
Copy link
Contributor Author

If #1253 lands, this change would be unnecessary as that also removes .is_ajax().

Copy link
Member

@tim-schilling tim-schilling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

not request.is_ajax()
if django.VERSION < (3, 1)
else request.accepts("text/html")
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rejig this to only check accepts_html in the case of show_toolbar returning True? Perhaps split it to another function call. This would keep the DEBUG=False pathway minimal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, thanks.

Now short circuits on not show_toolbar(request).

The method was deprecated in upstream commit
django/django@e348ab0.

Refs #1032
@auvipy auvipy merged commit 783781c into django-commons:master May 5, 2020
@jdufresne jdufresne deleted the ajax branch May 5, 2020 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants