From a921751e8ef88447bce7ca9522faa307a434a217 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Sun, 5 Apr 2015 18:17:27 -0500 Subject: [PATCH] stripe form bs3 compatible, disabled cache.ram max utilization --- applications/examples/views/appadmin.html | 12 ++-- gluon/cache.py | 2 +- gluon/contrib/stripe.py | 70 +++++++++++------------ gluon/packages/dal | 2 +- 4 files changed, 43 insertions(+), 43 deletions(-) diff --git a/applications/examples/views/appadmin.html b/applications/examples/views/appadmin.html index d8341969..6e12639d 100644 --- a/applications/examples/views/appadmin.html +++ b/applications/examples/views/appadmin.html @@ -18,7 +18,7 @@
- +
{{for db in sorted(databases):}} {{for table in databases[db].tables:}} {{qry='%s.%s.id>0'%(db,table)}} @@ -40,7 +40,7 @@ {{=A("%s.%s" % (db,table),_href=URL('select',args=[db],vars=dict(query=qry)))}} {{pass}} @@ -61,7 +61,7 @@ {{pass}} {{if table:}} - {{=A(str(T('New Record')),_href=URL('insert',args=[request.args[0],table]),_class="btn")}}

+ {{=A(str(T('New Record')),_href=URL('insert',args=[request.args[0],table]),_class="btn btn-default")}}

{{=T("Rows in Table")}}


{{else:}}

{{=T("Rows selected")}}


@@ -72,8 +72,8 @@ {{=T('"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN')}}



{{=T("%s selected", nrows)}}

- {{if start>0:}}{{=A(T('previous %s rows') % step,_href=URL('select',args=request.args[0],vars=dict(start=start-step)),_class="btn")}}{{pass}} - {{if stop0:}}{{=A(T('previous %s rows') % step,_href=URL('select',args=request.args[0],vars=dict(start=start-step)),_class="btn btn-default")}}{{pass}} + {{if stop {{linkto = lambda f, t, r: URL('update', args=[request.args[0], r, f]) if f else "#"}} @@ -82,7 +82,7 @@ {{pass}}

{{=T("Import/Export")}}


- {{=T("export as csv file")}} + {{=T("export as csv file")}} {{=formcsv or ''}} {{elif request.function=='insert':}} diff --git a/gluon/cache.py b/gluon/cache.py index a7d8aeba..ad32cb33 100644 --- a/gluon/cache.py +++ b/gluon/cache.py @@ -99,7 +99,7 @@ class CacheAbstract(object): """ cache_stats_name = 'web2py_cache_statistics' - max_ram_utilization = 90 # percent + max_ram_utilization = None # percent def __init__(self, request=None): """Initializes the object diff --git a/gluon/contrib/stripe.py b/gluon/contrib/stripe.py index a0f6ce6d..ec0bfa05 100644 --- a/gluon/contrib/stripe.py +++ b/gluon/contrib/stripe.py @@ -4,7 +4,24 @@ from hashlib import sha1 class Stripe: """ - Usage: + Use in WEB2PY (guaranteed PCI compliant) + +def pay(): + from gluon.contrib.stripe import StripeForm + form = StripeForm( + pk=STRIPE_PUBLISHABLE_KEY, + sk=STRIPE_SECRET_KEY, + amount=150, # $1.5 (amount is in cents) + description="Nothing").process() + if form.accepted: + payment_id = form.response['id'] + redirect(URL('thank_you')) + elif form.errors: + redirect(URL('pay_error')) + return dict(form=form) + +Low level API: + key='' d = Stripe(key).charge( amount=100, # 1 dollar!!!! @@ -22,22 +39,6 @@ class Stripe: {u'fee': 0, u'description': u'test charge', u'created': 1321242072, u'refunded': False, u'livemode': False, u'object': u'charge', u'currency': u'usd', u'amount': 100, u'paid': True, u'id': u'ch_sdjasgfga83asf', u'card': {u'exp_month': 5, u'country': u'US', u'object': u'card', u'last4': u'4242', u'exp_year': 2012, u'type': u'Visa'}} if paid is True than transaction was processed - Use in WEB2PY (guaranteed PCI compliant) - -def pay(): - from gluon.contrib.stripe import StripeForm - form = StripeForm( - pk=STRIPE_PUBLISHABLE_KEY, - sk=STRIPE_SECRET_KEY, - amount=150, # $1.5 (amount is in cents) - description="Nothing").process() - if form.accepted: - payment_id = form.response['id'] - redirect(URL('thank_you')) - elif form.errors: - redirect(URL('pay_error')) - return dict(form=form) - """ URL_CHARGE = 'https://%s:@api.stripe.com/v1/charges' @@ -188,37 +189,36 @@ jQuery(function(){

Payment Amount: {{=currency_symbol}} {{="%.2f" % (0.01*amount)}}

-
- -
+
+ +
+ placeholder="4242424242424242" class="form-control"/>
-
- -
+
+ +
+ placeholder="XXX" class="form-control"/> What is this?
-
- -
- +
+ +
+ / - +
- -
-
+
+
diff --git a/gluon/packages/dal b/gluon/packages/dal index b08cb1f7..5eef2e79 160000 --- a/gluon/packages/dal +++ b/gluon/packages/dal @@ -1 +1 @@ -Subproject commit b08cb1f779d1ef7973bf460344772778a344a077 +Subproject commit 5eef2e7943543820b9fa9a375d60c51ac1cfdaed
- {{=A(str(T('New Record')),_href=URL('insert',args=[db,table]),_class="btn")}} + {{=A(str(T('New Record')),_href=URL('insert',args=[db,table]),_class="btn btn-default")}}