web/views/basecontrollers.py
branchstable
changeset 6107 05061eda1fa7
parent 5940 0e3ae19b181a
child 6109 47d9c0e0f7b7
equal deleted inserted replaced
6106:1e6d93f70d14 6107:05061eda1fa7
   219         except ValidationError, ex:
   219         except ValidationError, ex:
   220             return (False, _validation_error(req, ex), ctrl._edited_entity)
   220             return (False, _validation_error(req, ex), ctrl._edited_entity)
   221         except Exception, ex:
   221         except Exception, ex:
   222             req.cnx.rollback()
   222             req.cnx.rollback()
   223             req.exception('unexpected error while validating form')
   223             req.exception('unexpected error while validating form')
   224             return (False, req._(str(ex).decode('utf-8')), ctrl._edited_entity)
   224             return (False, str(ex).decode('utf-8'), ctrl._edited_entity)
   225         else:
   225         else:
   226             # complete entity: it can be used in js callbacks where we might
   226             # complete entity: it can be used in js callbacks where we might
   227             # want every possible information
   227             # want every possible information
   228             if ctrl._edited_entity:
   228             if ctrl._edited_entity:
   229                 ctrl._edited_entity.complete()
   229                 ctrl._edited_entity.complete()
   230             return (True, ex.location, ctrl._edited_entity)
   230             return (True, ex.location, ctrl._edited_entity)
   231     except Exception, ex:
   231     except Exception, ex:
   232         req.cnx.rollback()
   232         req.cnx.rollback()
   233         req.exception('unexpected error while validating form')
   233         req.exception('unexpected error while validating form')
   234         return (False, req._(str(ex).decode('utf-8')), ctrl._edited_entity)
   234         return (False, str(ex).decode('utf-8'), ctrl._edited_entity)
   235     return (False, '???', None)
   235     return (False, '???', None)
   236 
   236 
   237 
   237 
   238 class FormValidatorController(Controller):
   238 class FormValidatorController(Controller):
   239     __regid__ = 'validateform'
   239     __regid__ = 'validateform'