From 6bbf79a1dbbfe0cfed81f56775f2e73bb412998f Mon Sep 17 00:00:00 2001 From: Tanshu Date: Sun, 16 Dec 2012 23:01:42 +0530 Subject: [PATCH] Tried to capture an error in purchase form where no ProductID key maybe locked the whole app on webfaction. --- brewman/brewman/views/services/voucher/purchase.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/brewman/brewman/views/services/voucher/purchase.py b/brewman/brewman/views/services/voucher/purchase.py index 2676c2c4..0e521191 100644 --- a/brewman/brewman/views/services/voucher/purchase.py +++ b/brewman/brewman/views/services/voucher/purchase.py @@ -25,6 +25,8 @@ def purchase_create_voucher(json, user): def purchase_create_inventory(voucher, item, date): + if 'Product' not in item or 'ProductID' not in item['Product']: + raise ValidationError('No Product in item') product = Product.by_id(uuid.UUID(item['Product']['ProductID'])) inventory_id = uuid.UUID(item['InventoryID']) if 'InventoryID' in item else None quantity = round(Decimal(item['Quantity']), 2)