summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/samples/store-gae/shopping-cart.py
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-07-01 06:04:47 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-07-01 06:04:47 +0000
commit69c5921fb2472f5cafa050dae088120ad17ed23a (patch)
treedb2bbd8dc4439139b6278408c82cec495b06d0d9 /sca-cpp/trunk/samples/store-gae/shopping-cart.py
parent8e35575af73a89217bc5f9dc14dd59428f5ee39a (diff)
Support user and email properties in WSGI integration.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@959523 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-cpp/trunk/samples/store-gae/shopping-cart.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/sca-cpp/trunk/samples/store-gae/shopping-cart.py b/sca-cpp/trunk/samples/store-gae/shopping-cart.py
index d124ce8517..04ad729585 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):
+def post(collection, item, cache, 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):
+def get(id, cache, 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):
+def delete(id, cache, email):
if id == ():
return cache("delete", (cartId,))
return True
@@ -68,7 +68,11 @@ def sum(items):
return price(items[0]) + sum(items[1:])
# Return the total price of the items in the cart
-def gettotal(cache):
+def gettotal(cache, email):
cart = getcart(cartId, cache)
return sum(cart)
+# Return the email of the cart owner
+def getemail(cache, email):
+ return email()
+