From a511682ce1f13d3d98ffa6fad6cbfc097ea163af Mon Sep 17 00:00:00 2001 From: mdipierro Date: Thu, 1 Nov 2012 22:01:57 -0500 Subject: [PATCH] better google wallet, checks parameters --- VERSION | 2 +- gluon/contrib/google_wallet.py | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/VERSION b/VERSION index 8a06df38..a9c592de 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.2.1 (2012-11-01 21:35:48) stable +Version 2.2.1 (2012-11-01 22:01:51) stable diff --git a/gluon/contrib/google_wallet.py b/gluon/contrib/google_wallet.py index f24c9074..b1da6200 100644 --- a/gluon/contrib/google_wallet.py +++ b/gluon/contrib/google_wallet.py @@ -1,16 +1,15 @@ from gluon import XML - def button(merchant_id="123456789012345", products=[dict(name="shoes", quantity=1, price=23.5, currency='USD', description="running shoes black")]): - t = '' + t = '\n' list_products = '' for k, product in enumerate(products): - for key, value in product.items(): - list_products += t % dict(k=k + 1, key=key, value=value) - button = '
%s
' % (merchant_id, list_products, merchant_id) + for key in ('name','description','quantity','price','currency'): + list_products += t % dict(k=k + 1, key=key, value=product[key]) + button = """
\n%(list_products)s\n\n
""" % dict(merchant_id=merchant_id, list_products=list_products) return XML(button)