Open GoogleCodeExporter opened 9 years ago
we can use queryMultiAdapter instead of getMultiAdapter in handle_load_template
Index: src/Products.PloneGetPaid/Products/PloneGetPaid/browser/cart.py
===================================================================
---
src/Products.PloneGetPaid/Products/PloneGetPaid/browser/cart.py (révision
158)
+++ src/Products.PloneGetPaid/Products/PloneGetPaid/browser/cart.py (copie de
travail)
@@ -436,14 +436,20 @@
cart = self.manager.__parent__.cart
for v in o.shopping_cart.values():
+ miss = 0
content = v.resolve()
- item_factory = component.getMultiAdapter( (cart, content),
+ item_factory = component.queryMultiAdapter( (cart, content),
interfaces.ILineItemFactory )
-
- if IVariableAmountDonatableMarker.providedBy(content):
- item_factory.create( amount=v.cost )
- else:
- item_factory.create( quantity=v.quantity )
-
- self.status = _(u"Previous Order Loaded into Cart")
-
+ if item_factory:
+ if IVariableAmountDonatableMarker.providedBy(content):
+ item_factory.create( amount=v.cost )
+ else:
+ item_factory.create( quantity=v.quantity )
+ else :
+ miss = miss + 1
+ if miss == len(o.shopping_cart)
+ self.status = _(u"Previous Order is no more applicable")
+ elif miss == 0 :
+ self.status = _(u"Previous Order loaded into Cart")
+ else :
+ self.status = _(u"Previous Order partially loaded into Cart : %s
items are missing") %miss
Original comment by danielle...@gmail.com
on 27 Dec 2010 at 12:41
Original issue reported on code.google.com by
danielle...@gmail.com
on 26 Dec 2010 at 5:24