Added the option of unlimited quotas

This commit is contained in:
Raphael Michel
2015-10-21 16:31:58 +02:00
parent 2fb90efa4d
commit a2af3db771
6 changed files with 55 additions and 10 deletions

View File

@@ -228,10 +228,11 @@ class Order(Versionable):
else:
# Use cached version
quota = quota_cache[quota.identity]
quota.cached_availability -= 1
if quota.cached_availability < 0:
# This quota is sold out/currently unavailable, so do not sell this at all
raise Quota.QuotaExceededException(error_messages['unavailable'])
if quota.cached_availability is not None:
quota.cached_availability -= 1
if quota.cached_availability < 0:
# This quota is sold out/currently unavailable, so do not sell this at all
raise Quota.QuotaExceededException(error_messages['unavailable'])
except Quota.QuotaExceededException as e:
return str(e)
return True