Tried to capture an error in purchase form where no ProductID key maybe locked the whole app on webfaction.

This commit is contained in:
Tanshu 2012-12-16 23:01:42 +05:30
parent bb1858fe88
commit 6bbf79a1db

View File

@ -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)