mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 19:10:07 -03:30
handle 404 returned by resolve()
* related to https://github.com/ansible/ansible-tower/issues/7926 * if 404 on url in migration loading middelware, do NOT short circuit middleware. Simply call the normal middlware code path in this case.
This commit is contained in:
parent
d5773c58d3
commit
ccfb6d64bf
14
awx/wsgi.py
14
awx/wsgi.py
@ -53,12 +53,16 @@ if settings.MIDDLEWARE:
|
||||
|
||||
class AWXWSGIHandler(WSGIHandler):
|
||||
def _legacy_get_response(self, request):
|
||||
# short-circuit middleware
|
||||
if getattr(resolve(request.path), 'url_name', '') == 'migrations_notran':
|
||||
return self._get_response(request)
|
||||
try:
|
||||
# resolve can raise a 404, in that case, pass through to the
|
||||
# "normal" middleware
|
||||
if getattr(resolve(request.path), 'url_name', '') == 'migrations_notran':
|
||||
# short-circuit middleware
|
||||
return self._get_response(request)
|
||||
except django.urls.Resolver404:
|
||||
pass
|
||||
# fall through to middle-ware
|
||||
else:
|
||||
return super(AWXWSGIHandler, self)._legacy_get_response(request)
|
||||
return super(AWXWSGIHandler, self)._legacy_get_response(request)
|
||||
|
||||
|
||||
# Return the default Django WSGI application.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user