diff options
Diffstat (limited to 'sca-cpp/trunk/samples/store-gae/shopping-cart.py')
-rw-r--r-- | sca-cpp/trunk/samples/store-gae/shopping-cart.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sca-cpp/trunk/samples/store-gae/shopping-cart.py b/sca-cpp/trunk/samples/store-gae/shopping-cart.py index 04ad729585..8d369e3315 100644 --- a/sca-cpp/trunk/samples/store-gae/shopping-cart.py +++ b/sca-cpp/trunk/samples/store-gae/shopping-cart.py @@ -30,7 +30,7 @@ def getcart(id, cache): return cart # Post a new item to the cart, create a new cart if necessary -def post(collection, item, cache, email): +def post(collection, item, cache, host, email): id = str(uuid.uuid1()) cart = ((item[0], id, item[2]),) + getcart(cartId, cache) cache("put", (cartId,), cart) @@ -46,13 +46,13 @@ def find(id, cart): return find(id, cart[1:]) # Get items from the cart -def get(id, cache, email): +def get(id, cache, host, email): if id == (): return ("Your Cart", cartId) + getcart(cartId, cache) return find(id[0], getcart(cartId, cache)) # Delete items from the cart -def delete(id, cache, email): +def delete(id, cache, host, email): if id == (): return cache("delete", (cartId,)) return True @@ -68,11 +68,15 @@ def sum(items): return price(items[0]) + sum(items[1:]) # Return the total price of the items in the cart -def gettotal(cache, email): +def gettotal(cache, host, email): cart = getcart(cartId, cache) return sum(cart) # Return the email of the cart owner -def getemail(cache, email): +def getemail(cache, host, email): return email() +# Return the host that the app is running on +def gethost(cache, host, email): + return host() + |