From 9ca17f883d7a637581befe8092120242d0534673 Mon Sep 17 00:00:00 2001 From: Florian Apolloner Date: Sun, 9 Sep 2012 13:00:10 +0200 Subject: [PATCH] Replace nested try/finally try/except with try/except/finally. --- django/core/handlers/wsgi.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/django/core/handlers/wsgi.py b/django/core/handlers/wsgi.py index e445d07a61..7a32a3dac7 100644 --- a/django/core/handlers/wsgi.py +++ b/django/core/handlers/wsgi.py @@ -223,18 +223,17 @@ class WSGIHandler(base.BaseHandler): set_script_prefix(base.get_script_name(environ)) signals.request_started.send(sender=self.__class__) try: - try: - request = self.request_class(environ) - except UnicodeDecodeError: - logger.warning('Bad Request (UnicodeDecodeError)', - exc_info=sys.exc_info(), - extra={ - 'status_code': 400, - } - ) - response = http.HttpResponseBadRequest() - else: - response = self.get_response(request) + request = self.request_class(environ) + except UnicodeDecodeError: + logger.warning('Bad Request (UnicodeDecodeError)', + exc_info=sys.exc_info(), + extra={ + 'status_code': 400, + } + ) + response = http.HttpResponseBadRequest() + else: + response = self.get_response(request) finally: signals.request_finished.send(sender=self.__class__)