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....