From 211b8cee2aec239f26892233477055899159d9e0 Mon Sep 17 00:00:00 2001 From: Tanshu Date: Mon, 17 Dec 2012 14:34:27 +0530 Subject: [PATCH] Added extended validation in Post. --- brewman/brewman/views/services/voucher/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/brewman/brewman/views/services/voucher/__init__.py b/brewman/brewman/views/services/voucher/__init__.py index d8ad9976..a6647f60 100644 --- a/brewman/brewman/views/services/voucher/__init__.py +++ b/brewman/brewman/views/services/voucher/__init__.py @@ -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