-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Conversation
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
Shouldn't this replace the is_ajax logic with another type of check that
inspects the request to be an ajax/json request to avoid running too much
of the toolbar unnecessarily?
…On Sat, Mar 28, 2020, 9:49 AM codecov[bot] ***@***.***> wrote:
Codecov
<https://codecov.io/gh/jazzband/django-debug-toolbar/pull/1253?src=pr&el=h1>
Report
Merging #1253
<https://codecov.io/gh/jazzband/django-debug-toolbar/pull/1253?src=pr&el=desc>
into master
<https://codecov.io/gh/jazzband/django-debug-toolbar/commit/bad48b28e74618c2d21453202b0ed59cdb9fd0b3&el=desc>
will *not change* coverage by %.
The diff coverage is 100.00%.
[image: Impacted file tree graph]
<https://codecov.io/gh/jazzband/django-debug-toolbar/pull/1253?src=pr&el=tree>
@@ 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
<https://codecov.io/gh/jazzband/django-debug-toolbar/pull/1253?src=pr&el=tree> Coverage
Δ
debug_toolbar/middleware.py
<https://codecov.io/gh/jazzband/django-debug-toolbar/pull/1253/diff?src=pr&el=tree#diff-ZGVidWdfdG9vbGJhci9taWRkbGV3YXJlLnB5> 90.47%
<100.00%> (ø)
------------------------------
Continue to review full report at Codecov
<https://codecov.io/gh/jazzband/django-debug-toolbar/pull/1253?src=pr&el=continue>
.
*Legend* - Click here to learn more
<https://docs.codecov.io/docs/codecov-delta>
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov
<https://codecov.io/gh/jazzband/django-debug-toolbar/pull/1253?src=pr&el=footer>.
Last update bad48b2...2ebf47d
<https://codecov.io/gh/jazzband/django-debug-toolbar/pull/1253?src=pr&el=lastupdated>.
Read the comment docs <https://docs.codecov.io/docs/pull-request-comments>
.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1253 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJYZP6MQF52YXNKSPXYEVTRJYE6HANCNFSM4LVTBK6A>
.
|
Good point. I've updated the change to use the new |
If #1253 lands, this change would be unnecessary as that also removes |
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.
Looks good to me.
debug_toolbar/middleware.py
Outdated
not request.is_ajax() | ||
if django.VERSION < (3, 1) | ||
else request.accepts("text/html") | ||
) |
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.
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.
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.
Good call, thanks.
Now short circuits on not show_toolbar(request)
.
The method was deprecated in upstream commit django/django@e348ab0. Refs #1032
The method was deprecated in upstream commit
django/django@e348ab0.
Refs #1032