middleware: Fix anonymous access to setup view

Django runs process_request() on all the middleware classes in order.
Then it runs process_view() on all of them again.  During the runs, if
any of the views return a HttpResponse.  Further processing is ignored.

Setup middleware was handling process_request() and returning
HttpResponse if the application as not setup.  However, stronghold
middleware handles process_view().  Since process_request happens first
and response is being returned there, stronghold middleware is never
called.

Make setup middleware use process_view() instead.
This commit is contained in:
Sunil Mohan Adapa 2016-06-01 15:20:21 +05:30 committed by James Valleroy
parent f5c4cdee58
commit f34cb78867
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -36,7 +36,7 @@ class SetupMiddleware(object):
"""Show setup page or progress if setup is neccessary or running."""
@staticmethod
def process_request(request):
def process_view(request, view_func, view_args, view_kwargs):
"""Handle a request as Django middleware request handler."""
# Perform a URL resolution. This is slightly inefficient as
# Django will do this resolution again.