diff options
Diffstat (limited to '')
-rw-r--r-- | sca-cpp/trunk/samples/store-python/shopping-cart.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sca-cpp/trunk/samples/store-python/shopping-cart.py b/sca-cpp/trunk/samples/store-python/shopping-cart.py index 405adb85bf..feb7398ed9 100644 --- a/sca-cpp/trunk/samples/store-python/shopping-cart.py +++ b/sca-cpp/trunk/samples/store-python/shopping-cart.py @@ -24,7 +24,7 @@ cartId = "1234" # Get the shopping cart from the cache # Return an empty cart if not found def getcart(id, cache): - cart = cache("get", (id,)) + cart = cache.get((id,)) if cart is None: return () return cart @@ -33,7 +33,7 @@ def getcart(id, cache): def post(collection, item, cache): id = str(uuid.uuid1()) cart = ((item[0], id, item[2]),) + getcart(cartId, cache) - cache("put", (cartId,), cart) + cache.put((cartId,), cart) return (id,) @@ -55,7 +55,7 @@ def get(id, cache): # Delete items from the cart def delete(id, cache): if id == (): - return cache("delete", (cartId,)) + return cache.delete((cartId,)) return True # Return the price of an item @@ -69,7 +69,7 @@ def sum(items): return price(items[0]) + sum(items[1:]) # Return the total price of the items in the cart -def gettotal(cache): +def total(cache): cart = getcart(cartId, cache) return sum(cart) |