Skip to content
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

Handle PermissionDenied like Http404 #68

Merged
merged 4 commits into from Sep 1, 2021

Conversation

rabbit-aaron
Copy link
Contributor

@rabbit-aaron rabbit-aaron commented Aug 25, 2021

Django's PermissionDenied is used very similar to the Http404, I think that should be handled the same way.
here's the doc:
https://docs.djangoproject.com/en/3.2/ref/urls/#handler403
https://docs.djangoproject.com/en/3.2/ref/views/#django.views.defaults.permission_denied

Django's permission denied should be handled by handler403 defined in the urls.py
and in this case it would return a 403 rather than a 500
@rabbit-aaron rabbit-aaron changed the title Update request.py WIP: Update request.py Aug 25, 2021
@codecov
Copy link

codecov bot commented Aug 25, 2021

Codecov Report

Merging #68 (b2bd464) into master (26ba752) will decrease coverage by 0.41%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##            master      #68      +/-   ##
===========================================
- Coverage   100.00%   99.58%   -0.42%     
===========================================
  Files           42       42              
  Lines         1162     1199      +37     
===========================================
+ Hits          1162     1194      +32     
- Misses           0        5       +5     
Impacted Files Coverage Δ
django_structlog/middlewares/request.py 100.00% <100.00%> (ø)
test_app/tests/middlewares/test_request.py 100.00% <100.00%> (ø)
test_app/tests/celery/test_steps.py 75.00% <0.00%> (-25.00%) ⬇️

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 26ba752...b2bd464. Read the comment docs.

@rabbit-aaron rabbit-aaron changed the title WIP: Update request.py Handle PermissionDenied like Http404 Aug 26, 2021
@jrobichaud jrobichaud merged commit dcc3734 into jrobichaud:master Sep 1, 2021
@jrobichaud
Copy link
Owner

@rabbit-aaron thank you for your contribution. It is released in 2.1.2. I credited you in the change log as I do normally.

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.

None yet

2 participants