Compare commits
20
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f7bf1020df | ||
|
|
75b8ceb022 | ||
|
|
b4f3784136 | ||
|
|
f1297bb827 | ||
|
|
435ebeaae4 | ||
|
|
537045082c | ||
|
|
4bea52a7b5 | ||
|
|
33295e516f | ||
|
|
f33ccf3366 | ||
|
|
0784680c90 | ||
|
|
e940228eaf | ||
|
|
50769a627a | ||
|
|
e68ecaa131 | ||
|
|
95e6e8577b | ||
|
|
19c83d4ad6 | ||
|
|
9c92bd1050 | ||
|
|
b3b95ccf5f | ||
|
|
cefa30841b | ||
|
|
15ff8669cb | ||
|
|
a921751e8e |
@@ -180,6 +180,11 @@ class Servers:
|
|||||||
s = wsgi.WSGIServer(callable=app, bind="%s:%d" % address)
|
s = wsgi.WSGIServer(callable=app, bind="%s:%d" % address)
|
||||||
s.start()
|
s.start()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def waitress(app, address, **options):
|
||||||
|
from waitress import serve
|
||||||
|
serve(app, host=address[0], port=address[1], _quiet=True)
|
||||||
|
|
||||||
|
|
||||||
def mongrel2_handler(application, conn, debug=False):
|
def mongrel2_handler(application, conn, debug=False):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<div class="tab-pane active" id="alltables">
|
<div class="tab-pane active" id="alltables">
|
||||||
<table>
|
<table class="table">
|
||||||
{{for db in sorted(databases):}}
|
{{for db in sorted(databases):}}
|
||||||
{{for table in databases[db].tables:}}
|
{{for table in databases[db].tables:}}
|
||||||
{{qry='%s.%s.id>0'%(db,table)}}
|
{{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)))}}
|
{{=A("%s.%s" % (db,table),_href=URL('select',args=[db],vars=dict(query=qry)))}}
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
{{=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")}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{pass}}
|
{{pass}}
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
</pre>
|
</pre>
|
||||||
{{pass}}
|
{{pass}}
|
||||||
{{if table:}}
|
{{if table:}}
|
||||||
{{=A(str(T('New Record')),_href=URL('insert',args=[request.args[0],table]),_class="btn")}}<br/><br/>
|
{{=A(str(T('New Record')),_href=URL('insert',args=[request.args[0],table]),_class="btn btn-default")}}<br/><br/>
|
||||||
<h3>{{=T("Rows in Table")}}</h3><br/>
|
<h3>{{=T("Rows in Table")}}</h3><br/>
|
||||||
{{else:}}
|
{{else:}}
|
||||||
<h3>{{=T("Rows selected")}}</h3><br/>
|
<h3>{{=T("Rows selected")}}</h3><br/>
|
||||||
@@ -72,8 +72,8 @@
|
|||||||
{{=T('"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN')}}</p>
|
{{=T('"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN')}}</p>
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
<h4>{{=T("%s selected", nrows)}}</h4>
|
<h4>{{=T("%s selected", nrows)}}</h4>
|
||||||
{{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 start>0:}}{{=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<nrows:}}{{=A(T('next %s rows') % step,_href=URL('select',args=request.args[0],vars=dict(start=start+step)),_class="btn")}}{{pass}}
|
{{if stop<nrows:}}{{=A(T('next %s rows') % step,_href=URL('select',args=request.args[0],vars=dict(start=start+step)),_class="btn btn-default")}}{{pass}}
|
||||||
{{if rows:}}
|
{{if rows:}}
|
||||||
<div style="overflow:auto; width:80%;">
|
<div style="overflow:auto; width:80%;">
|
||||||
{{linkto = lambda f, t, r: URL('update', args=[request.args[0], r, f]) if f else "#"}}
|
{{linkto = lambda f, t, r: URL('update', args=[request.args[0], r, f]) if f else "#"}}
|
||||||
@@ -82,7 +82,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{{pass}}
|
{{pass}}
|
||||||
<br/><br/><h3>{{=T("Import/Export")}}</h3><br/>
|
<br/><br/><h3>{{=T("Import/Export")}}</h3><br/>
|
||||||
<a href="{{=URL('csv',args=request.args[0],vars=dict(query=query))}}" class="btn">{{=T("export as csv file")}}</a>
|
<a href="{{=URL('csv',args=request.args[0],vars=dict(query=query))}}" class="btn btn-default">{{=T("export as csv file")}}</a>
|
||||||
{{=formcsv or ''}}
|
{{=formcsv or ''}}
|
||||||
|
|
||||||
{{elif request.function=='insert':}}
|
{{elif request.function=='insert':}}
|
||||||
|
|||||||
@@ -33,6 +33,9 @@
|
|||||||
<li><a target="_blank" href="https://loadinfo-net.appspot.com">LoadInfo</a> (Bulgaria)</li>
|
<li><a target="_blank" href="https://loadinfo-net.appspot.com">LoadInfo</a> (Bulgaria)</li>
|
||||||
<li><a target="_blank" href="http://www.appliedobjects.com">Applied Objects</a> (New Zealand)</li>
|
<li><a target="_blank" href="http://www.appliedobjects.com">Applied Objects</a> (New Zealand)</li>
|
||||||
<li><a target="_blank" href="http://www.sistemasagiles.com.ar/">Sistemas Ágiles</a> ("Agile Systems") (Argentina)</li>
|
<li><a target="_blank" href="http://www.sistemasagiles.com.ar/">Sistemas Ágiles</a> ("Agile Systems") (Argentina)</li>
|
||||||
|
<li><a target="_blank" href="http://www.definescope.com/en/services/consulting/">DefineScope</a> (Portugal)</li>
|
||||||
|
<li><a target="_blank" href="http://10Biosystems.com">10BioSystems</a></li>
|
||||||
|
<li><a target="_blank" href="http://www.dutveul.nl">Dutveul</a> (Netherlands)</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+2
-2
@@ -99,7 +99,7 @@ class CacheAbstract(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
cache_stats_name = 'web2py_cache_statistics'
|
cache_stats_name = 'web2py_cache_statistics'
|
||||||
max_ram_utilization = 90 # percent
|
max_ram_utilization = None # percent
|
||||||
|
|
||||||
def __init__(self, request=None):
|
def __init__(self, request=None):
|
||||||
"""Initializes the object
|
"""Initializes the object
|
||||||
@@ -353,7 +353,7 @@ class CacheOnDisk(CacheAbstract):
|
|||||||
raise KeyError
|
raise KeyError
|
||||||
|
|
||||||
self.wait_portalock(val_file)
|
self.wait_portalock(val_file)
|
||||||
value = pickle.load(recfile.open(key, 'rb', path=self.folder))
|
value = pickle.load(val_file)
|
||||||
val_file.close()
|
val_file.close()
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|||||||
+35
-17
@@ -25,7 +25,7 @@ pooling = True
|
|||||||
apilevel = '2.0'
|
apilevel = '2.0'
|
||||||
paramstyle = 'qmark'
|
paramstyle = 'qmark'
|
||||||
threadsafety = 1
|
threadsafety = 1
|
||||||
version = '1.3.0'
|
version = '1.3.3'
|
||||||
lowercase=True
|
lowercase=True
|
||||||
|
|
||||||
DEBUG = 0
|
DEBUG = 0
|
||||||
@@ -89,7 +89,7 @@ SQL_ATTR_AUTOCOMMIT = SQL_AUTOCOMMIT = 102
|
|||||||
SQL_MODE_DEFAULT = SQL_MODE_READ_WRITE = 0; SQL_MODE_READ_ONLY = 1
|
SQL_MODE_DEFAULT = SQL_MODE_READ_WRITE = 0; SQL_MODE_READ_ONLY = 1
|
||||||
SQL_AUTOCOMMIT_OFF, SQL_AUTOCOMMIT_ON = 0, 1
|
SQL_AUTOCOMMIT_OFF, SQL_AUTOCOMMIT_ON = 0, 1
|
||||||
SQL_IS_UINTEGER = -5
|
SQL_IS_UINTEGER = -5
|
||||||
SQL_ATTR_LOGIN_TIMEOUT = 103; SQL_ATTR_CONNECTION_TIMEOUT = 113
|
SQL_ATTR_LOGIN_TIMEOUT = 103; SQL_ATTR_CONNECTION_TIMEOUT = 113;SQL_ATTR_QUERY_TIMEOUT = 0
|
||||||
SQL_COMMIT, SQL_ROLLBACK = 0, 1
|
SQL_COMMIT, SQL_ROLLBACK = 0, 1
|
||||||
|
|
||||||
SQL_INDEX_UNIQUE,SQL_INDEX_ALL = 0,1
|
SQL_INDEX_UNIQUE,SQL_INDEX_ALL = 0,1
|
||||||
@@ -565,19 +565,21 @@ def dttm_cvt(x):
|
|||||||
if py_v3:
|
if py_v3:
|
||||||
x = x.decode('ascii')
|
x = x.decode('ascii')
|
||||||
if x == '': return None
|
if x == '': return None
|
||||||
else: return datetime.datetime(int(x[0:4]),int(x[5:7]),int(x[8:10]),int(x[10:13]),int(x[14:16]),int(x[17:19]),int(x[20:].ljust(6,'0')))
|
x = x.ljust(26,'0')
|
||||||
|
return datetime.datetime(int(x[0:4]),int(x[5:7]),int(x[8:10]),int(x[10:13]),int(x[14:16]),int(x[17:19]),int(x[20:26]))
|
||||||
|
|
||||||
def tm_cvt(x):
|
def tm_cvt(x):
|
||||||
if py_v3:
|
if py_v3:
|
||||||
x = x.decode('ascii')
|
x = x.decode('ascii')
|
||||||
if x == '': return None
|
if x == '': return None
|
||||||
else: return datetime.time(int(x[0:2]),int(x[3:5]),int(x[6:8]),int(x[9:].ljust(6,'0')))
|
x = x.ljust(15,'0')
|
||||||
|
return datetime.time(int(x[0:2]),int(x[3:5]),int(x[6:8]),int(x[9:15]))
|
||||||
|
|
||||||
def dt_cvt(x):
|
def dt_cvt(x):
|
||||||
if py_v3:
|
if py_v3:
|
||||||
x = x.decode('ascii')
|
x = x.decode('ascii')
|
||||||
if x == '': return None
|
if x == '': return None
|
||||||
else: return datetime.date(int(x[0:4]),int(x[5:7]),int(x[8:10]))
|
else:return datetime.date(int(x[0:4]),int(x[5:7]),int(x[8:10]))
|
||||||
|
|
||||||
def Decimal_cvt(x):
|
def Decimal_cvt(x):
|
||||||
if py_v3:
|
if py_v3:
|
||||||
@@ -696,6 +698,7 @@ funcs_with_ret = [
|
|||||||
"SQLStatisticsW",
|
"SQLStatisticsW",
|
||||||
"SQLTables",
|
"SQLTables",
|
||||||
"SQLTablesW",
|
"SQLTablesW",
|
||||||
|
"SQLSetStmtAttr"
|
||||||
]
|
]
|
||||||
|
|
||||||
for func_name in funcs_with_ret:
|
for func_name in funcs_with_ret:
|
||||||
@@ -1168,9 +1171,18 @@ class Cursor:
|
|||||||
self.arraysize = 1
|
self.arraysize = 1
|
||||||
ret = ODBC_API.SQLAllocHandle(SQL_HANDLE_STMT, self.connection.dbc_h, ADDR(self.stmt_h))
|
ret = ODBC_API.SQLAllocHandle(SQL_HANDLE_STMT, self.connection.dbc_h, ADDR(self.stmt_h))
|
||||||
check_success(self, ret)
|
check_success(self, ret)
|
||||||
|
|
||||||
|
self.timeout = conx.timeout
|
||||||
|
if self.timeout != 0:
|
||||||
|
self.set_timeout(self.timeout)
|
||||||
|
|
||||||
self._PARAM_SQL_TYPE_LIST = []
|
self._PARAM_SQL_TYPE_LIST = []
|
||||||
self.closed = False
|
self.closed = False
|
||||||
|
|
||||||
|
def set_timeout(self, timeout):
|
||||||
|
self.timeout = timeout
|
||||||
|
ret = ODBC_API.SQLSetStmtAttr(self.stmt_h, SQL_ATTR_QUERY_TIMEOUT, self.timeout, 0)
|
||||||
|
check_success(self, ret)
|
||||||
|
|
||||||
def prepare(self, query_string):
|
def prepare(self, query_string):
|
||||||
"""prepare a query"""
|
"""prepare a query"""
|
||||||
@@ -2369,10 +2381,14 @@ class Cursor:
|
|||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# This class implement a odbc connection.
|
# This class implement a odbc connection.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
connection_timeout = 0
|
||||||
|
|
||||||
class Connection:
|
class Connection:
|
||||||
def __init__(self, connectString = '', autocommit = False, ansi = False, timeout = 0, unicode_results = use_unicode, readonly = False, **kargs):
|
def __init__(self, connectString = '', autocommit = False, ansi = False, timeout = 0, unicode_results = use_unicode, readonly = False, **kargs):
|
||||||
@@ -2384,6 +2400,7 @@ class Connection:
|
|||||||
self.dbc_h = ctypes.c_void_p()
|
self.dbc_h = ctypes.c_void_p()
|
||||||
self.autocommit = autocommit
|
self.autocommit = autocommit
|
||||||
self.readonly = False
|
self.readonly = False
|
||||||
|
# the query timeout value
|
||||||
self.timeout = 0
|
self.timeout = 0
|
||||||
# self._cursors = []
|
# self._cursors = []
|
||||||
for key, value in list(kargs.items()):
|
for key, value in list(kargs.items()):
|
||||||
@@ -2409,9 +2426,17 @@ class Connection:
|
|||||||
ret = ODBC_API.SQLAllocHandle(SQL_HANDLE_DBC, shared_env_h, ADDR(self.dbc_h))
|
ret = ODBC_API.SQLAllocHandle(SQL_HANDLE_DBC, shared_env_h, ADDR(self.dbc_h))
|
||||||
check_success(self, ret)
|
check_success(self, ret)
|
||||||
|
|
||||||
|
self.connection_timeout = connection_timeout
|
||||||
|
if self.connection_timeout != 0:
|
||||||
|
self.set_connection_timeout(connection_timeout)
|
||||||
|
|
||||||
|
|
||||||
self.connect(connectString, autocommit, ansi, timeout, unicode_results, readonly)
|
self.connect(connectString, autocommit, ansi, timeout, unicode_results, readonly)
|
||||||
|
|
||||||
|
def set_connection_timeout(self,connection_timeout):
|
||||||
|
self.connection_timeout = connection_timeout
|
||||||
|
ret = ODBC_API.SQLSetConnectAttr(self.dbc_h, SQL_ATTR_CONNECTION_TIMEOUT, connection_timeout, SQL_IS_UINTEGER);
|
||||||
|
check_success(self, ret)
|
||||||
|
|
||||||
def connect(self, connectString = '', autocommit = False, ansi = False, timeout = 0, unicode_results = use_unicode, readonly = False):
|
def connect(self, connectString = '', autocommit = False, ansi = False, timeout = 0, unicode_results = use_unicode, readonly = False):
|
||||||
"""Connect to odbc, using connect strings and set the connection's attributes like autocommit and timeout
|
"""Connect to odbc, using connect strings and set the connection's attributes like autocommit and timeout
|
||||||
@@ -2421,11 +2446,8 @@ class Connection:
|
|||||||
# Before we establish the connection by the connection string
|
# Before we establish the connection by the connection string
|
||||||
# Set the connection's attribute of "timeout" (Actully LOGIN_TIMEOUT)
|
# Set the connection's attribute of "timeout" (Actully LOGIN_TIMEOUT)
|
||||||
if timeout != 0:
|
if timeout != 0:
|
||||||
self.settimeout(timeout)
|
|
||||||
ret = ODBC_API.SQLSetConnectAttr(self.dbc_h, SQL_ATTR_LOGIN_TIMEOUT, timeout, SQL_IS_UINTEGER);
|
ret = ODBC_API.SQLSetConnectAttr(self.dbc_h, SQL_ATTR_LOGIN_TIMEOUT, timeout, SQL_IS_UINTEGER);
|
||||||
check_success(self, ret)
|
check_success(self, ret)
|
||||||
|
|
||||||
|
|
||||||
# Create one connection with a connect string by calling SQLDriverConnect
|
# Create one connection with a connect string by calling SQLDriverConnect
|
||||||
# and make self.dbc_h the handle of this connection
|
# and make self.dbc_h the handle of this connection
|
||||||
|
|
||||||
@@ -2474,9 +2496,9 @@ class Connection:
|
|||||||
# Set the connection's attribute of "readonly"
|
# Set the connection's attribute of "readonly"
|
||||||
#
|
#
|
||||||
self.readonly = readonly
|
self.readonly = readonly
|
||||||
|
if self.readonly == True:
|
||||||
ret = ODBC_API.SQLSetConnectAttr(self.dbc_h, SQL_ATTR_ACCESS_MODE, self.readonly and SQL_MODE_READ_ONLY or SQL_MODE_READ_WRITE, SQL_IS_UINTEGER)
|
ret = ODBC_API.SQLSetConnectAttr(self.dbc_h, SQL_ATTR_ACCESS_MODE, SQL_MODE_READ_ONLY, SQL_IS_UINTEGER)
|
||||||
check_success(self, ret)
|
check_success(self, ret)
|
||||||
|
|
||||||
self.unicode_results = unicode_results
|
self.unicode_results = unicode_results
|
||||||
self.connected = 1
|
self.connected = 1
|
||||||
@@ -2491,10 +2513,6 @@ class Connection:
|
|||||||
def add_output_converter(self, sqltype, func):
|
def add_output_converter(self, sqltype, func):
|
||||||
self.output_converter[sqltype] = func
|
self.output_converter[sqltype] = func
|
||||||
|
|
||||||
def settimeout(self, timeout):
|
|
||||||
ret = ODBC_API.SQLSetConnectAttr(self.dbc_h, SQL_ATTR_CONNECTION_TIMEOUT, timeout, SQL_IS_UINTEGER);
|
|
||||||
check_success(self, ret)
|
|
||||||
self.timeout = timeout
|
|
||||||
|
|
||||||
|
|
||||||
def ConnectByDSN(self, dsn, user, passwd = ''):
|
def ConnectByDSN(self, dsn, user, passwd = ''):
|
||||||
|
|||||||
+35
-35
@@ -4,7 +4,24 @@ from hashlib import sha1
|
|||||||
|
|
||||||
class Stripe:
|
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='<api key>'
|
key='<api key>'
|
||||||
d = Stripe(key).charge(
|
d = Stripe(key).charge(
|
||||||
amount=100, # 1 dollar!!!!
|
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'}}
|
{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
|
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'
|
URL_CHARGE = 'https://%s:@api.stripe.com/v1/charges'
|
||||||
@@ -188,37 +189,36 @@ jQuery(function(){
|
|||||||
<h3>Payment Amount: {{=currency_symbol}} {{="%.2f" % (0.01*amount)}}</h3>
|
<h3>Payment Amount: {{=currency_symbol}} {{="%.2f" % (0.01*amount)}}</h3>
|
||||||
<form action="" method="POST" id="payment-form" class="form-horizontal">
|
<form action="" method="POST" id="payment-form" class="form-horizontal">
|
||||||
|
|
||||||
<div class="form-row control-group">
|
<div class="form-row form-group">
|
||||||
<label class="control-label">Card Number</label>
|
<label class="col-sm-2 control-label">Card Number</label>
|
||||||
<div class="controls">
|
<div class="controls col-sm-10">
|
||||||
<input type="text" size="20" data-stripe="number"
|
<input type="text" size="20" data-stripe="number"
|
||||||
placeholder="4242424242424242"/>
|
placeholder="4242424242424242" class="form-control"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-row control-group">
|
<div class="form-row form-group">
|
||||||
<label class="control-label">CVC</label>
|
<label class="col-sm-2 control-label">CVC</label>
|
||||||
<div class="controls">
|
<div class="controls col-sm-10">
|
||||||
<input type="text" size="4" style="width:80px" data-stripe="cvc"
|
<input type="text" size="4" style="width:80px" data-stripe="cvc"
|
||||||
placeholder="XXX"/>
|
placeholder="XXX" class="form-control"/>
|
||||||
<a href="http://en.wikipedia.org/wiki/Card_Verification_Code" target="_blank">What is this?</a>
|
<a href="http://en.wikipedia.org/wiki/Card_Verification_Code" target="_blank">What is this?</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-row control-group">
|
<div class="form-row form-group">
|
||||||
<label class="control-label">Expiration</label>
|
<label class="col-sm-2 control-label">Expiration</label>
|
||||||
<div class="controls">
|
<div class="controls col-sm-10">
|
||||||
<input type="text" size="2" style="width:40px" data-stripe="exp-month"
|
<input type="text" size="2" style="width:40px; display:inline-block"
|
||||||
placeholder="MM"/>
|
data-stripe="exp-month" placeholder="MM" class="form-control"/>
|
||||||
/
|
/
|
||||||
<input type="text" size="4" style="width:80px" data-stripe="exp-year"
|
<input type="text" size="4" style="width:80px; display:inline-block"
|
||||||
placeholder="YYYY"/>
|
data-stripe="exp-year" placeholder="YYYY" class="form-control"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row form-group">
|
||||||
<div class="control-group">
|
<div class="controls col-sm-offset-2 col-sm-10">
|
||||||
<div class="controls">
|
|
||||||
<button type="submit" class="btn btn-primary">Submit Payment</button>
|
<button type="submit" class="btn btn-primary">Submit Payment</button>
|
||||||
<div class="payment-errors error hidden"></div>
|
<div class="payment-errors error hidden"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+3
-3
@@ -14,7 +14,7 @@ from pydal import DAL as DAL
|
|||||||
from pydal import Field
|
from pydal import Field
|
||||||
from pydal.objects import Row, Rows, Table, Query, Expression
|
from pydal.objects import Row, Rows, Table, Query, Expression
|
||||||
from pydal import SQLCustomType, geoPoint, geoLine, geoPolygon
|
from pydal import SQLCustomType, geoPoint, geoLine, geoPolygon
|
||||||
import copy_reg as copyreg
|
|
||||||
|
|
||||||
def _default_validators(db, field):
|
def _default_validators(db, field):
|
||||||
"""
|
"""
|
||||||
@@ -81,12 +81,12 @@ def _default_validators(db, field):
|
|||||||
requires[0] = validators.IS_EMPTY_OR(requires[0])
|
requires[0] = validators.IS_EMPTY_OR(requires[0])
|
||||||
return requires
|
return requires
|
||||||
|
|
||||||
from gluon import serializers as w2p_serializers
|
from gluon.serializers import custom_json, xml
|
||||||
from gluon.utils import web2py_uuid
|
from gluon.utils import web2py_uuid
|
||||||
from gluon import sqlhtml
|
from gluon import sqlhtml
|
||||||
|
|
||||||
|
|
||||||
DAL.serializers = w2p_serializers
|
DAL.serializers = {'json': custom_json, 'xml': xml}
|
||||||
DAL.validators_method = _default_validators
|
DAL.validators_method = _default_validators
|
||||||
DAL.uuid = lambda x: web2py_uuid()
|
DAL.uuid = lambda x: web2py_uuid()
|
||||||
DAL.representers = {
|
DAL.representers = {
|
||||||
|
|||||||
+1
-1
Submodule gluon/packages/dal updated: b08cb1f779...9272062bf1
+15
-3
@@ -58,9 +58,12 @@ def represent(field, value, record):
|
|||||||
f = field.represent
|
f = field.represent
|
||||||
if not callable(f):
|
if not callable(f):
|
||||||
return str(value)
|
return str(value)
|
||||||
n = f.func_code.co_argcount - len(f.func_defaults or [])
|
if hasattr(f,'func_code'):
|
||||||
if getattr(f, 'im_self', None):
|
n = f.func_code.co_argcount - len(f.func_defaults or [])
|
||||||
n -= 1
|
if getattr(f, 'im_self', None):
|
||||||
|
n -= 1
|
||||||
|
else:
|
||||||
|
n = 1
|
||||||
if n == 1:
|
if n == 1:
|
||||||
return f(value)
|
return f(value)
|
||||||
elif n == 2:
|
elif n == 2:
|
||||||
@@ -1205,6 +1208,9 @@ class SQLFORM(FORM):
|
|||||||
elif field.type == 'boolean':
|
elif field.type == 'boolean':
|
||||||
inp = self.widgets.boolean.widget(
|
inp = self.widgets.boolean.widget(
|
||||||
field, default, _disabled=True)
|
field, default, _disabled=True)
|
||||||
|
elif isinstance(field.type, SQLCustomType) and callable(field.type.represent):
|
||||||
|
# SQLCustomType has a represent, use it
|
||||||
|
inp = field.type.represent(default, record)
|
||||||
else:
|
else:
|
||||||
inp = field.formatter(default)
|
inp = field.formatter(default)
|
||||||
if getattr(field, 'show_if', None):
|
if getattr(field, 'show_if', None):
|
||||||
@@ -1246,6 +1252,9 @@ class SQLFORM(FORM):
|
|||||||
dspval = ''
|
dspval = ''
|
||||||
elif field.type == 'blob':
|
elif field.type == 'blob':
|
||||||
continue
|
continue
|
||||||
|
elif isinstance(field.type, SQLCustomType) and callable(field.type.widget):
|
||||||
|
# SQLCustomType has a widget, use it
|
||||||
|
inp = field.type.widget(field, default)
|
||||||
else:
|
else:
|
||||||
field_type = widget_class.match(str(field.type)).group()
|
field_type = widget_class.match(str(field.type)).group()
|
||||||
field_type = field_type in self.widgets and field_type or 'string'
|
field_type = field_type in self.widgets and field_type or 'string'
|
||||||
@@ -2708,6 +2717,9 @@ class SQLFORM(FORM):
|
|||||||
_href='%s/%s' % (upload, value))
|
_href='%s/%s' % (upload, value))
|
||||||
else:
|
else:
|
||||||
value = ''
|
value = ''
|
||||||
|
elif isinstance(field.type, SQLCustomType) and callable(field.type.represent):
|
||||||
|
# SQLCustomType has a represent, use it
|
||||||
|
value = field.type.represent(value, row)
|
||||||
if isinstance(value, str):
|
if isinstance(value, str):
|
||||||
value = truncate_string(value, maxlength)
|
value = truncate_string(value, maxlength)
|
||||||
elif not isinstance(value, XmlComponent):
|
elif not isinstance(value, XmlComponent):
|
||||||
|
|||||||
@@ -15,10 +15,11 @@ from gluon.dal import DAL, Field
|
|||||||
|
|
||||||
class TestDALSubclass(unittest.TestCase):
|
class TestDALSubclass(unittest.TestCase):
|
||||||
def testRun(self):
|
def testRun(self):
|
||||||
import gluon.serializers as mserializers
|
from gluon.serializers import custom_json, xml
|
||||||
from gluon import sqlhtml
|
from gluon import sqlhtml
|
||||||
db = DAL(check_reserved=['all'])
|
db = DAL(check_reserved=['all'])
|
||||||
self.assertEqual(db.serializers, mserializers)
|
self.assertEqual(db.serializers['json'], custom_json)
|
||||||
|
self.assertEqual(db.serializers['xml'], xml)
|
||||||
self.assertEqual(db.representers['rows_render'], sqlhtml.represent)
|
self.assertEqual(db.representers['rows_render'], sqlhtml.represent)
|
||||||
self.assertEqual(db.representers['rows_xml'], sqlhtml.SQLTABLE)
|
self.assertEqual(db.representers['rows_xml'], sqlhtml.SQLTABLE)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -611,7 +611,7 @@ class IS_IN_DB(Validator):
|
|||||||
|
|
||||||
def count(values, s=self.dbset, f=field):
|
def count(values, s=self.dbset, f=field):
|
||||||
return s(f.belongs(map(int, values))).count()
|
return s(f.belongs(map(int, values))).count()
|
||||||
if isinstance(self.dbset.db._adapter, GoogleDatastoreAdapter):
|
if GoogleDatastoreAdapter is not None and isinstance(self.dbset.db._adapter, GoogleDatastoreAdapter):
|
||||||
range_ids = range(0, len(values), 30)
|
range_ids = range(0, len(values), 30)
|
||||||
total = sum(count(values[i:i + 30]) for i in range_ids)
|
total = sum(count(values[i:i + 30]) for i in range_ids)
|
||||||
if total == len(values):
|
if total == len(values):
|
||||||
|
|||||||
Reference in New Issue
Block a user