Open GoogleCodeExporter opened 9 years ago
In cart.py in def handle_update there is a raise statement
once deleted,
we can put qty = int(self.request.get('quantity', 1)) inside a try except
which solves the problem of a string that can't be converted to a number
and finally we can by default set qty to 1 if a negative number is entered
---
src/Products.PloneGetPaid/Products/PloneGetPaid/browser/cart.py (révision
156)
+++ src/Products.PloneGetPaid/Products/PloneGetPaid/browser/cart.py (copie de
travail)
@@ -83,8 +83,15 @@
item_factory = component.getMultiAdapter( (self.cart, self.context),
interfaces.ILineItemFactory )
# check quantity from request
- qty = int(self.request.get('quantity', 1))
+ qty=1
try:
+ qty = int(self.request.get('quantity', 1))
+ except ValueError :
+ pass
+ finally:
+ if qty <0 :
+ qty = 1
+ try:
item_factory.create(quantity=qty)
except interfaces.AddRecurringItemException:
@@ -316,6 +323,7 @@
@form.action(_("Update"), condition="isNotEmpty")
def handle_update( self, action, data ):
+
try:
data = self.quantity_column.input(self.container.values(), self.request)
self.form_reset = True
@@ -324,7 +332,6 @@
if self.container[item_id].quantity == 0:
del self.container[ item_id ]
except:
- raise
self.form_reset = True
#reset the form data in the request
for i in self.request.form.keys():
Original comment by danielle...@gmail.com
on 16 Dec 2010 at 2:28
Original issue reported on code.google.com by
lucielej...@gmail.com
on 17 Apr 2009 at 3:22