When you enter a non integer value for the number of items in the cart
listing you have got an exception.
So I try to have my own class ShoppingCartListing :
class ShoppingCartListing(PGP_ShoppingCartListing):
# to change templates
# to use my cartformatter
# to hopefully patch handle_update
# quantity integer
http://code.google.com/p/getpaid/issues/detail?id=255 template = ZopeTwoPageTemplateFile('templates/cart-listing.pt')
formatter_factory = CartFormatter
@form.action(_("Update"), condition="isNotEmpty")
def handle_update(self, action, data):
try:
data = self.quantity_column.input(self.container.values(),
self.request)
except: # put everything back
self.form_reset = True
for i in self.request.form.keys():
self.request.form.pop(i)
self.form_reset = True
self.quantity_column.update(self.container.values(), data)
for item_id in self.container:
if self.container[item_id].quantity == 0: # remove everything
del self.container[item_id]
It works ( although not for the negative numbers yet )
but
ONLY if I change in the class FieldEditColumn(Column), the method input
from
......
if widget.hasInput():
try:
data[id] = widget.getInputValue()
except WidgetInputError, v:
raise errors.append(v)
.....
to
......
if widget.hasInput():
try:
data[id] = widget.getInputValue()
except :#WidgetInputError, v:
raise #errors.append(v)
.......
Some advice needed....
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "getpaid-dev" group.
To post to this group, send email to
getpaid-dev@...
To unsubscribe from this group, send email to
getpaid-dev+unsubscribe@...
For more options, visit this group at
http://groups.google.com/group/getpaid-dev?hl=en-~----------~----~----~----~------~----~------~--~---