changeset 4330:b6d5bf04b9e6

try/except/finally is 2.5+ only, use try/try/except/finally
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Wed, 24 Sep 2008 01:14:19 +0200
parents d9d151ce2f6f
children ee11391a1423
files MoinMoin/wsgiapp.py
diffstat 1 files changed, 16 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/wsgiapp.py	Tue Sep 23 23:02:50 2008 +0200
+++ b/MoinMoin/wsgiapp.py	Wed Sep 24 01:14:19 2008 +0200
@@ -57,22 +57,23 @@
 
     # preliminary access checks (forbidden, bots, surge protection)
     try:
-        check_forbidden(context)
-        check_surge_protect(context)
-
-        action_name = context.action
+        try:
+            check_forbidden(context)
+            check_surge_protect(context)
 
-        # handle XMLRPC calls
-        if action_name == 'xmlrpc':
-            response = xmlrpc.xmlrpc(XMLRPCContext(request))
-        elif action_name == 'xmlrpc2':
-            response = xmlrpc.xmlrpc2(XMLRPCContext(request))
-        else:
-            response = dispatch(request, context, action_name)
-        context.cfg.session_service.finalize(context, context.session)
-        return response
-    except MoinMoinFinish:
-        return request
+            action_name = context.action
+
+            # handle XMLRPC calls
+            if action_name == 'xmlrpc':
+                response = xmlrpc.xmlrpc(XMLRPCContext(request))
+            elif action_name == 'xmlrpc2':
+                response = xmlrpc.xmlrpc2(XMLRPCContext(request))
+            else:
+                response = dispatch(request, context, action_name)
+            context.cfg.session_service.finalize(context, context.session)
+            return response
+        except MoinMoinFinish:
+            return request
     finally:
         context.clock.stop('run')