diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2011-03-08 08:18:07 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2011-03-08 08:18:07 +0000 |
commit | 49b878b1b0f2e52bbd5282c22ac32a68e1e8736c (patch) | |
tree | 1eb26926f9d703c61b329a0f07178090b57cd55d /sca-cpp/trunk/samples/store-vhost/domains/jane/shopping-cart.py | |
parent | 5b33dc5c5a87fff146951ca0543bf558454c331d (diff) |
Change ATOM and RSS feed representations to use name value pairs instead of just strings, to allow support for all ATOM and RSS attributes and avoid confusion with non-feed string results.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1079292 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/samples/store-vhost/domains/jane/shopping-cart.py')
-rw-r--r-- | sca-cpp/trunk/samples/store-vhost/domains/jane/shopping-cart.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sca-cpp/trunk/samples/store-vhost/domains/jane/shopping-cart.py b/sca-cpp/trunk/samples/store-vhost/domains/jane/shopping-cart.py index feb7398ed9..1dac82522f 100644 --- a/sca-cpp/trunk/samples/store-vhost/domains/jane/shopping-cart.py +++ b/sca-cpp/trunk/samples/store-vhost/domains/jane/shopping-cart.py @@ -32,7 +32,7 @@ def getcart(id, cache): # Post a new item to the cart, create a new cart if necessary def post(collection, item, cache): id = str(uuid.uuid1()) - cart = ((item[0], id, item[2]),) + getcart(cartId, cache) + cart = (("'entry", item[0][1], ("'id", id), item[0][3]),) + getcart(cartId, cache) cache.put((cartId,), cart) return (id,) @@ -40,16 +40,16 @@ def post(collection, item, cache): # Find an item in the cart def find(id, cart): if cart == (): - return ("Item", "0", ()) - elif id == cart[0][1]: - return cart[0] + return (("'entry", ("'title", "Item"), ("'id", 0)),) + elif id == cart[0][2][1]: + return (cart[0],) else: return find(id, cart[1:]) # Get items from the cart def get(id, cache): if id == (): - return ("Your Cart", cartId) + getcart(cartId, cache) + return ((("'feed", ("'title", "Your Cart"), ("'id", cartId)) + getcart(cartId, cache)),) return find(id[0], getcart(cartId, cache)) # Delete items from the cart @@ -60,7 +60,7 @@ def delete(id, cache): # Return the price of an item def price(item): - return float(filter(lambda x: x[0] == "'price", item[2])[0][1]) + return float(filter(lambda x: x[0] == "'price", item[3][1][1:])[0][1]) # Sum the prices of a list of items def sum(items): |