Added extended validation in Post.
This commit is contained in:
parent
4833a96ba9
commit
211b8cee2a
@ -1,5 +1,4 @@
|
||||
import uuid
|
||||
from datetime import date
|
||||
from pyramid.response import Response
|
||||
from pyramid.security import authenticated_userid
|
||||
from pyramid.view import view_config
|
||||
@ -57,7 +56,7 @@ def voucher_post(request):
|
||||
voucher.poster_id = user.id
|
||||
transaction.commit()
|
||||
return voucher_info(Voucher.by_id(voucher.id))
|
||||
except ValidationError as ex:
|
||||
except (ValidationError, ValueError, KeyError, AttributeError) as ex:
|
||||
transaction.abort()
|
||||
response = Response("Failed validation: {0}".format(ex.message))
|
||||
response.status_int = 500
|
||||
|
Loading…
Reference in New Issue
Block a user