Opened 25 hours ago

Last modified 10 hours ago

#36848 assigned Cleanup/optimization

Documentation doesn't directly mention that BadRequest is handled by handler400

Reported by: Lincoln Owned by: Kundan Yadav
Component: Documentation Version: dev
Severity: Normal Keywords: handler400 bad_request
Cc: Lincoln Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

A BadRequest exception raised in a view, is handled by the handler400 view (default django.views.defaults.bad_request).

https://github.com/django/django/blob/c68e4adea0703354508d51895b091771b1f6ac45/django/core/handlers/exception.py#L96-L104

Looking at the documentation, I can't see this link mentioned anywhere.

Places I looked:

For comparison, This section about the 404 view

https://docs.djangoproject.com/en/dev/ref/views/#the-404-page-not-found-view

explicitly says "When you raise Http404 from within a view, ..."

Change History (5)

comment:1 by Kundan Yadav, 18 hours ago

Owner: set to Kundan Yadav
Status: newassigned

comment:2 by Natalia Bidart, 17 hours ago

Keywords: handler400 bad_request added
Triage Stage: UnreviewedAccepted
Version: dev

Hello Lincoln! Thanks for the report.

While the current documentation already describes this behavior indirectly (the BadRequest exception docs says they resul in an HttpResponseBadRequest at the handler level with a status code of 400, and handler400 being responsible for rendering 400 responses), I agree that an explicit mention similar to Http404 would improve clarity. Accepting this as a small documentation clarification.

comment:3 by Natalia Bidart, 17 hours ago

Kundan, just a quick suggestion regarding ticket assignments: while you are getting started with Django contributions, it is usually best to focus on one ticket at a time and see it through fully, including reviews and any required follow-ups, before taking on additional tickets. This helps keep tickets moving and avoids unintentionally blocking other contributors. Thanks! and I appreciate the interest in contributing.

comment:4 by Natalia Bidart, 17 hours ago

Summary: Documentation doesn't mention that BadRequest is handled by handler400Documentation doesn't directly mention that BadRequest is handled by handler400

comment:5 by Kundan Yadav, 10 hours ago

i am sorry again i will keep all this in my mind am really sorry again

Note: See TracTickets for help on using tickets.
Back to Top