Opened 79 minutes ago
#36790 new Cleanup/optimization
Refactor error view handlers to be generic
| Reported by: | Wes P. | Owned by: | |
|---|---|---|---|
| Component: | HTTP handling | Version: | 6.0 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
In a PR review discussion (see: https://github.com/django/django/pull/17960/files) which was reviewing ticket #35281 (adding a new handler for 413 errors) it was expressed that there should be a better way to allow developers to access handlers instead of creating handlers for every kind of 4xx or 5xx error: a generic method. Ticket #35281 switched from being about a 413 handler (fairly easy) to refactoring error view handlers.
I would like ticket #35281 to revert to being about handling 413 errors (which was accepted) and for this ticket to be about refactoring error view handlers to be generic. I would also recommend that we preserve backward compatibility without deprecating the existing handlers.
Documentation for error views: https://docs.djangoproject.com/en/6.0/ref/views/#error-views