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-gae | |
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 '')
-rw-r--r-- | sca-cpp/trunk/samples/store-gae/htdocs/index.html | 9 | ||||
-rw-r--r-- | sca-cpp/trunk/samples/store-gae/shopping-cart.py | 12 |
2 files changed, 13 insertions, 8 deletions
diff --git a/sca-cpp/trunk/samples/store-gae/htdocs/index.html b/sca-cpp/trunk/samples/store-gae/htdocs/index.html index d4884cf4d5..e16890eee4 100644 --- a/sca-cpp/trunk/samples/store-gae/htdocs/index.html +++ b/sca-cpp/trunk/samples/store-gae/htdocs/index.html @@ -24,6 +24,10 @@ <link rel="stylesheet" type="text/css" href="/ui.css"/>
<title>Store</title>
+<script type="text/javascript" src="/util.js"></script>
+<script type="text/javascript" src="/elemutil.js"></script>
+<script type="text/javascript" src="/xmlutil.js"></script>
+<script type="text/javascript" src="/atomutil.js"></script>
<script type="text/javascript" src="/component.js"></script>
<script type="text/javascript">
@@ -65,8 +69,9 @@ function shoppingCart_emailResponse(email, exception) { document.getElementById('email').innerHTML = email;
}
-function shoppingCart_getResponse(feed) {
- if (feed != null) {
+function shoppingCart_getResponse(doc) {
+ if (doc != null) {
+ var feed = parseXML([doc]);
var entries = feed.getElementsByTagName("entry");
var list = "";
for (var i=0; i<entries.length; i++) {
diff --git a/sca-cpp/trunk/samples/store-gae/shopping-cart.py b/sca-cpp/trunk/samples/store-gae/shopping-cart.py index 3c3168d77b..11a55a552a 100644 --- a/sca-cpp/trunk/samples/store-gae/shopping-cart.py +++ b/sca-cpp/trunk/samples/store-gae/shopping-cart.py @@ -32,23 +32,23 @@ def getcart(id, cache): # Post a new item to the cart, create a new cart if necessary def post(collection, item, cache, host, email): 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,) # 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, host, email): 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 @@ -59,7 +59,7 @@ def delete(id, cache, host, email): # 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): |