Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Replace nested try/finally try/except with try/except/finally.

  • Loading branch information...
commit 9ca17f883d7a637581befe8092120242d0534673 1 parent 5e99a3d
Florian Apolloner authored

Showing 1 changed file with 11 additions and 12 deletions. Show diff stats Hide diff stats

  1. 23  django/core/handlers/wsgi.py
23  django/core/handlers/wsgi.py
@@ -223,18 +223,17 @@ def __call__(self, environ, start_response):
223 223
         set_script_prefix(base.get_script_name(environ))
224 224
         signals.request_started.send(sender=self.__class__)
225 225
         try:
226  
-            try:
227  
-                request = self.request_class(environ)
228  
-            except UnicodeDecodeError:
229  
-                logger.warning('Bad Request (UnicodeDecodeError)',
230  
-                    exc_info=sys.exc_info(),
231  
-                    extra={
232  
-                        'status_code': 400,
233  
-                    }
234  
-                )
235  
-                response = http.HttpResponseBadRequest()
236  
-            else:
237  
-                response = self.get_response(request)
  226
+            request = self.request_class(environ)
  227
+        except UnicodeDecodeError:
  228
+            logger.warning('Bad Request (UnicodeDecodeError)',
  229
+                exc_info=sys.exc_info(),
  230
+                extra={
  231
+                    'status_code': 400,
  232
+                }
  233
+            )
  234
+            response = http.HttpResponseBadRequest()
  235
+        else:
  236
+            response = self.get_response(request)
238 237
         finally:
239 238
             signals.request_finished.send(sender=self.__class__)
240 239
 

0 notes on commit 9ca17f8

Please sign in to comment.
Something went wrong with that request. Please try again.