Code

Opened 5 years ago

Closed 5 years ago

#11378 closed (duplicate)

Exceptions raised in Middleware process_request methods are not handled

Reported by: ssdd Owned by: nobody
Component: Core (Other) Version: master
Severity: Keywords: unhandled exception, middleware
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

In django.core.handlers.base.BaseHandler.get_response, running the Middleware process_request methods is done before the big try-except block that handles 404s and other exceptions. I'm not sure if this is intentional, but it makes it hard, for example, to send a standard 404 from process_request by raising Http404, as all exceptions raised here are unhandled and make it to the web server.

I've included a quick patch to fix this. I might be wrong.

Thanks

Attachments (1)

patch (1.3 KB) - added by ssdd 5 years ago.

Download all attachments as: .zip

Change History (2)

Changed 5 years ago by ssdd

comment:1 Changed 5 years ago by Alex

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

Dupe of #6094

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.