diff options
Diffstat (limited to '')
-rw-r--r-- | sca-cpp/trunk/samples/store-gae/fruits-catalog.py | 6 | ||||
-rw-r--r-- | sca-cpp/trunk/samples/store-gae/htdocs/index.html | 4 | ||||
-rw-r--r-- | sca-cpp/trunk/samples/store-gae/shopping-cart.py | 12 | ||||
-rw-r--r-- | sca-cpp/trunk/samples/store-gae/store.py | 16 |
4 files changed, 19 insertions, 19 deletions
diff --git a/sca-cpp/trunk/samples/store-gae/fruits-catalog.py b/sca-cpp/trunk/samples/store-gae/fruits-catalog.py index ab599e8400..4b2baca2ff 100644 --- a/sca-cpp/trunk/samples/store-gae/fruits-catalog.py +++ b/sca-cpp/trunk/samples/store-gae/fruits-catalog.py @@ -18,10 +18,10 @@ # Catalog implementation def items(converter, currencyCode): - code = currencyCode() + code = currencyCode.eval() def convert(price): - return converter("convert", "USD", code, price) - symbol = converter("symbol", code) + return converter.convert("USD", code, price) + symbol = converter.symbol(code) return ( (("'name", "Platano"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(2.99))), (("'name", "Banana"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(3.55))), diff --git a/sca-cpp/trunk/samples/store-gae/htdocs/index.html b/sca-cpp/trunk/samples/store-gae/htdocs/index.html index aee6ad5f70..8907cc6b49 100644 --- a/sca-cpp/trunk/samples/store-gae/htdocs/index.html +++ b/sca-cpp/trunk/samples/store-gae/htdocs/index.html @@ -79,11 +79,11 @@ function shoppingCart_getResponse(feed) { }
document.getElementById("shoppingCart").innerHTML = list;
- shoppingTotal.apply("gettotal", shoppingTotal_gettotalResponse);
+ shoppingTotal.apply("total", shoppingTotal_totalResponse);
}
}
-function shoppingTotal_gettotalResponse(total,exception) {
+function shoppingTotal_totalResponse(total,exception) {
if (exception) {
alert(exception.message);
return;
diff --git a/sca-cpp/trunk/samples/store-gae/shopping-cart.py b/sca-cpp/trunk/samples/store-gae/shopping-cart.py index 8d369e3315..6501f3db8d 100644 --- a/sca-cpp/trunk/samples/store-gae/shopping-cart.py +++ b/sca-cpp/trunk/samples/store-gae/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, host, email): id = str(uuid.uuid1()) cart = ((item[0], id, item[2]),) + getcart(cartId, cache) - cache("put", (cartId,), cart) + cache.put((cartId,), cart) return (id,) # Find an item in the cart @@ -54,7 +54,7 @@ def get(id, cache, host, email): # Delete items from the cart def delete(id, cache, host, email): if id == (): - return cache("delete", (cartId,)) + return cache.delete((cartId,)) return True # Return the price of an item @@ -68,15 +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, host, email): +def total(cache, host, email): cart = getcart(cartId, cache) return sum(cart) # Return the email of the cart owner def getemail(cache, host, email): - return email() + return email.eval() # Return the host that the app is running on def gethost(cache, host, email): - return host() + return host.eval() diff --git a/sca-cpp/trunk/samples/store-gae/store.py b/sca-cpp/trunk/samples/store-gae/store.py index becd1d14a5..ff82f1d327 100644 --- a/sca-cpp/trunk/samples/store-gae/store.py +++ b/sca-cpp/trunk/samples/store-gae/store.py @@ -18,23 +18,23 @@ # Store implementation def post(item, catalog, shoppingCart, shoppingTotal): - return shoppingCart("post", item) + return shoppingCart.post(item) def getall(catalog, shoppingCart, shoppingTotal): - return shoppingCart("getall") + return shoppingCart.getall() def get(id, catalog, shoppingCart, shoppingTotal): - return shoppingCart("get", id) + return shoppingCart.get(id) def items(catalog, shoppingCart, shoppingTotal): - return catalog("items") + return catalog.items() -def gettotal(catalog, shoppingCart, shoppingTotal): - return shoppingCart("gettotal") +def total(catalog, shoppingCart, shoppingTotal): + return shoppingCart.total() def deleteall(catalog, shoppingCart, shoppingTotal): - return shoppingCart("deleteall") + return shoppingCart.deleteall() def delete(id, catalog, shoppingCart, shoppingTotal): - return shoppingCart("delete", id) + return shoppingCart.delete(id) |