X-Git-Url: https://git.llucax.com/z.facultad/75.52/sercom.git/blobdiff_plain/0ce291818f5426dd53bb37e1f06f53f90d693005..b095cc64b996bdb63bbddd051887a6180770c684:/sercom/subcontrollers/validate.py diff --git a/sercom/subcontrollers/validate.py b/sercom/subcontrollers/validate.py index 67b749a..1495a9a 100644 --- a/sercom/subcontrollers/validate.py +++ b/sercom/subcontrollers/validate.py @@ -3,17 +3,13 @@ __all__ = ('validate_get', 'validate_set', 'validate_new') from turbogears import redirect +from cherrypy import NotFound def validate_get(cls, name, id, url='../list'): try: - id = int(id) - except ValueError: - raise redirect(url, tg_flash=_(u'Identificador inválido: %s.') % id) - try: - return cls.get(id) - except LookupError: - raise redirect(url, tg_flash=_(u'No existe %s con identificador %d') - % (name, id)) + return cls.get(int(id)) + except (ValueError, LookupError): + raise NotFound def validate_set(cls, name, id, data, url='../edit'): r = validate_get(cls, name, id)