web/application.py
changeset 8560 fef0b8214fcf
parent 8556 bbe0d6985e59
child 8594 001159e2e4f3
equal deleted inserted replaced
8559:8db29e17dd33 8560:fef0b8214fcf
   459         ### error case
   459         ### error case
   460         except NotFound, ex:
   460         except NotFound, ex:
   461             result = self.notfound_content(req)
   461             result = self.notfound_content(req)
   462             req.status_out = ex.status
   462             req.status_out = ex.status
   463         except ValidationError, ex:
   463         except ValidationError, ex:
   464             req.status_out = httplib.CONFLICT
       
   465             result = self.validation_error_handler(req, ex)
   464             result = self.validation_error_handler(req, ex)
   466         except RemoteCallFailed, ex:
   465         except RemoteCallFailed, ex:
   467             result = self.ajax_error_handler(req, ex)
   466             result = self.ajax_error_handler(req, ex)
   468         except Unauthorized, ex:
   467         except Unauthorized, ex:
   469             req.data['errmsg'] = req._('You\'re not authorized to access this page. '
   468             req.data['errmsg'] = req._('You\'re not authorized to access this page. '
   478                 req.cnx.commit()
   477                 req.cnx.commit()
   479             raise
   478             raise
   480         except (AuthenticationError, LogOut):
   479         except (AuthenticationError, LogOut):
   481             # the rollback is handled in the finally
   480             # the rollback is handled in the finally
   482             raise
   481             raise
   483         ### Last defence line
   482         ### Last defense line
   484         except BaseException, ex:
   483         except BaseException, ex:
   485             result = self.error_handler(req, ex, tb=True)
   484             result = self.error_handler(req, ex, tb=True)
   486         finally:
   485         finally:
   487             if req.cnx and not commited:
   486             if req.cnx and not commited:
   488                 try:
   487                 try:
   524             # messages.
   523             # messages.
   525             location = req.form['__errorurl'].rsplit('#', 1)[0]
   524             location = req.form['__errorurl'].rsplit('#', 1)[0]
   526             req.headers_out.setHeader('location', str(location))
   525             req.headers_out.setHeader('location', str(location))
   527             req.status_out = httplib.SEE_OTHER
   526             req.status_out = httplib.SEE_OTHER
   528             return ''
   527             return ''
       
   528         req.status_out = httplib.CONFLICT
   529         return self.error_handler(req, ex, tb=False)
   529         return self.error_handler(req, ex, tb=False)
   530 
   530 
   531     def error_handler(self, req, ex, tb=False):
   531     def error_handler(self, req, ex, tb=False):
   532         excinfo = sys.exc_info()
   532         excinfo = sys.exc_info()
   533         if tb:
   533         if tb: