web/application.py
changeset 10820 fef0ab4c4f94
parent 10777 eabacd3c6f16
equal deleted inserted replaced
10819:5b5864483c4d 10820:fef0ab4c4f94
   437         """
   437         """
   438         self.debug('redirecting to %s', str(ex.location))
   438         self.debug('redirecting to %s', str(ex.location))
   439         req.headers_out.setHeader('location', str(ex.location))
   439         req.headers_out.setHeader('location', str(ex.location))
   440         assert 300 <= ex.status < 400
   440         assert 300 <= ex.status < 400
   441         req.status_out = ex.status
   441         req.status_out = ex.status
   442         return ''
   442         return b''
   443 
   443 
   444     def validation_error_handler(self, req, ex):
   444     def validation_error_handler(self, req, ex):
   445         ex.translate(req._) # translate messages using ui language
   445         ex.translate(req._) # translate messages using ui language
   446         if '__errorurl' in req.form:
   446         if '__errorurl' in req.form:
   447             forminfo = {'error': ex,
   447             forminfo = {'error': ex,
   454             # the browser to move to the form since it hides the global
   454             # the browser to move to the form since it hides the global
   455             # messages.
   455             # messages.
   456             location = req.form['__errorurl'].rsplit('#', 1)[0]
   456             location = req.form['__errorurl'].rsplit('#', 1)[0]
   457             req.headers_out.setHeader('location', str(location))
   457             req.headers_out.setHeader('location', str(location))
   458             req.status_out = http_client.SEE_OTHER
   458             req.status_out = http_client.SEE_OTHER
   459             return ''
   459             return b''
   460         req.status_out = http_client.CONFLICT
   460         req.status_out = http_client.CONFLICT
   461         return self.error_handler(req, ex, tb=False)
   461         return self.error_handler(req, ex, tb=False)
   462 
   462 
   463     def error_handler(self, req, ex, tb=False):
   463     def error_handler(self, req, ex, tb=False):
   464         excinfo = sys.exc_info()
   464         excinfo = sys.exc_info()