Propagates the per_user_limit category error to the products, rather than the category.

Fixes #79.
This commit is contained in:
Christopher Neugebauer 2016-09-13 13:19:53 +10:00
parent 3903d2be56
commit 1c239c361f

View file

@ -205,12 +205,11 @@ class CartController(object):
to_add = sum(i[1] for i in by_cat[category])
if to_add > limit:
errors.append((
category,
"You may only have %d items in category: %s" % (
limit, category.name,
)
))
message = "You may only have %d items in category: %s" % (
limit, category.name,
)
for product, quantity in by_cat[category]:
errors.append((product, message))
# Test the flag conditions
errs = FlagController.test_flags(