mirror of
https://github.com/django/django.git
synced 2024-12-25 10:35:48 +00:00
Replace nested try/finally try/except with try/except/finally.
This commit is contained in:
parent
5e99a3d41b
commit
9ca17f883d
@ -223,18 +223,17 @@ class WSGIHandler(base.BaseHandler):
|
|||||||
set_script_prefix(base.get_script_name(environ))
|
set_script_prefix(base.get_script_name(environ))
|
||||||
signals.request_started.send(sender=self.__class__)
|
signals.request_started.send(sender=self.__class__)
|
||||||
try:
|
try:
|
||||||
try:
|
request = self.request_class(environ)
|
||||||
request = self.request_class(environ)
|
except UnicodeDecodeError:
|
||||||
except UnicodeDecodeError:
|
logger.warning('Bad Request (UnicodeDecodeError)',
|
||||||
logger.warning('Bad Request (UnicodeDecodeError)',
|
exc_info=sys.exc_info(),
|
||||||
exc_info=sys.exc_info(),
|
extra={
|
||||||
extra={
|
'status_code': 400,
|
||||||
'status_code': 400,
|
}
|
||||||
}
|
)
|
||||||
)
|
response = http.HttpResponseBadRequest()
|
||||||
response = http.HttpResponseBadRequest()
|
else:
|
||||||
else:
|
response = self.get_response(request)
|
||||||
response = self.get_response(request)
|
|
||||||
finally:
|
finally:
|
||||||
signals.request_finished.send(sender=self.__class__)
|
signals.request_finished.send(sender=self.__class__)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user