web/application.py
changeset 8695 358d8bed9626
parent 8694 d901c36bcfce
child 8696 0bb18407c053
--- a/web/application.py	Thu Feb 14 15:39:23 2013 +0100
+++ b/web/application.py	Thu Feb 14 15:38:25 2013 +0100
@@ -362,7 +362,7 @@
                 ### Try to generate the actual request content
                 content = self.core_handle(req, path)
             # Handle user log-out
-            except LogOut, ex:
+            except LogOut as ex:
                 # When authentification is handled by cookie the code that
                 # raised LogOut must has invalidated the cookie. We can just
                 # reload the original url without authentification
@@ -380,7 +380,7 @@
                     content = self.loggedout_content(req)
                     # let the explicitly reset http credential
                     raise AuthenticationError()
-        except Redirect, ex:
+        except Redirect as ex:
             # authentication needs redirection (eg openid)
             content = self.redirect_handler(req, ex)
         # Wrong, absent or Reseted credential
@@ -441,12 +441,12 @@
                     raise Unauthorized(req._('not authorized'))
                 req.update_search_state()
                 result = controller.publish(rset=rset)
-            except StatusResponse, ex:
+            except StatusResponse as ex:
                 warn('StatusResponse is deprecated use req.status_out',
                      DeprecationWarning)
                 result = ex.content
                 req.status_out = ex.status
-            except Redirect, ex:
+            except Redirect as ex:
                 # Redirect may be raised by edit controller when everything went
                 # fine, so attempt to commit
                 result = self.redirect_handler(req, ex)
@@ -456,24 +456,24 @@
                 if txuuid is not None:
                     req.data['last_undoable_transaction'] = txuuid
         ### error case
-        except NotFound, ex:
+        except NotFound as ex:
             result = self.notfound_content(req)
             req.status_out = ex.status
-        except ValidationError, ex:
+        except ValidationError as ex:
             result = self.validation_error_handler(req, ex)
-        except RemoteCallFailed, ex:
+        except RemoteCallFailed as ex:
             result = self.ajax_error_handler(req, ex)
-        except Unauthorized, ex:
+        except Unauthorized as ex:
             req.data['errmsg'] = req._('You\'re not authorized to access this page. '
                                        'If you think you should, please contact the site administrator.')
             req.status_out = httplib.UNAUTHORIZED
             result = self.error_handler(req, ex, tb=False)
-        except Forbidden, ex:
+        except Forbidden as ex:
             req.data['errmsg'] = req._('This action is forbidden. '
                                        'If you think it should be allowed, please contact the site administrator.')
             req.status_out = httplib.FORBIDDEN
             result = self.error_handler(req, ex, tb=False)
-        except (BadRQLQuery, RequestError), ex:
+        except (BadRQLQuery, RequestError) as ex:
             result = self.error_handler(req, ex, tb=False)
         ### pass through exception
         except DirectResponse:
@@ -484,7 +484,7 @@
             # the rollback is handled in the finally
             raise
         ### Last defense line
-        except BaseException, ex:
+        except BaseException as ex:
             result = self.error_handler(req, ex, tb=True)
         finally:
             if req.cnx and not commited: