Merge branch 'master' of github.com:web2py/web2py

This commit is contained in:
mdipierro
2015-03-29 18:07:29 -05:00
10 changed files with 58 additions and 49 deletions
@@ -3,12 +3,13 @@ def index():
def data():
if not session.m or len(session.m) == 10:
if not session.m:
session.m = []
if request.vars.q:
if len(session.m) == 10:
del(session.m[0])
session.m.append(request.vars.q)
session.m.sort()
return TABLE(*[TR(v) for v in session.m]).xml()
return TABLE(*[TR(v) for v in sorted(session.m)]).xml()
def flash():
+2
View File
@@ -120,6 +120,8 @@ def _():
'http://www.web2py.com/book/default/chapter/13'),
(T('Other Recipes'), False,
'http://www.web2py.com/book/default/chapter/14'),
(T('Helping web2py'), False,
'http://www.web2py.com/book/default/chapter/15'),
(T("Buy web2py's book"), False,
'http://stores.lulu.com/web2py'),
]),
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
View File
File diff suppressed because one or more lines are too long
+6 -6
View File
@@ -18,7 +18,7 @@
</ul>
<div class="tab-content">
<div class="tab-pane active" id="alltables">
<table>
<table class="table">
{{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)))}}
</th>
<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>
</tr>
{{pass}}
@@ -61,7 +61,7 @@
</pre>
{{pass}}
{{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/>
{{else:}}
<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>
<br/><br/>
<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 stop<nrows:}}{{=A(T('next %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 btn-default")}}{{pass}}
{{if rows:}}
<div style="overflow:auto; width:80%;">
{{linkto = lambda f, t, r: URL('update', args=[request.args[0], r, f]) if f else "#"}}
@@ -82,7 +82,7 @@
</div>
{{pass}}
<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 ''}}
{{elif request.function=='insert':}}
+2 -1
View File
@@ -166,7 +166,8 @@ class RestrictedError(Exception):
}
ticket_storage = TicketStorage(db=request.tickets_db)
ticket_storage.store(request, request.uuid.split('/', 1)[1], d)
if global_settings.cmd_options.print_errors:
cmd_opts = global_settings.cmd_options
if cmd_opts and cmd_opts.print_errors:
logger.error(self.traceback)
return request.uuid
except:
+32 -33
View File
@@ -903,7 +903,7 @@ def formstyle_bootstrap3_inline_factory(col_label_size=3):
label['_for'] = None
label.insert(0, controls)
_controls = DIV(DIV(label, _help, _class="checkbox"),
_class="%s %s" % (offset_class, col_class))
_class="%s %s" % (offset_class, col_class))
label = ''
elif isinstance(controls, (SELECT, TEXTAREA)):
controls.add_class('form-control')
@@ -1590,7 +1590,7 @@ class SQLFORM(FORM):
(cStringIO.StringIO(f), 'file.txt')
else:
# this should never happen, why does it happen?
# print 'f=',repr(f)
# print 'f=', repr(f)
continue
newfilename = field.store(source_file, original_filename,
field.uploadfolder)
@@ -1827,16 +1827,16 @@ class SQLFORM(FORM):
else:
field_type = field.type
operators = SELECT(*[OPTION(T(option), _value=option) for option in options],_class='form-control')
operators = SELECT(*[OPTION(T(option), _value=option) for option in options], _class='form-control')
_id = "%s_%s" % (value_id, name)
if field_type in ['boolean', 'double', 'time', 'integer']:
value_input = SQLFORM.widgets[field_type].widget(field, field.default, _id=_id,_class='form-control')
value_input = SQLFORM.widgets[field_type].widget(field, field.default, _id=_id, _class='form-control')
elif field_type == 'date':
iso_format = {'_data-w2p_date_format' : '%Y-%m-%d'}
value_input = SQLFORM.widgets.date.widget(field, field.default, _id=_id,_class='form-control', **iso_format)
value_input = SQLFORM.widgets.date.widget(field, field.default, _id=_id, _class='form-control', **iso_format)
elif field_type == 'datetime':
iso_format = {'_data-w2p_datetime_format' : '%Y-%m-%d %H:%M:%S'}
value_input = SQLFORM.widgets.datetime.widget(field, field.default, _id=_id,_class='form-control', **iso_format)
value_input = SQLFORM.widgets.datetime.widget(field, field.default, _id=_id, _class='form-control', **iso_format)
elif (field_type.startswith('reference ') or
field_type.startswith('list:reference ')) and \
hasattr(field.requires, 'options'):
@@ -1848,7 +1848,7 @@ class SQLFORM(FORM):
elif field_type.startswith('reference ') or \
field_type.startswith('list:integer') or \
field_type.startswith('list:reference '):
value_input = SQLFORM.widgets.integer.widget(field, field.default, _id=_id,_class='form-control')
value_input = SQLFORM.widgets.integer.widget(field, field.default, _id=_id, _class='form-control')
else:
value_input = INPUT(
_type='text', _id=_id,
@@ -2041,7 +2041,7 @@ class SQLFORM(FORM):
c = 'count(*)'
nrows = dbset.select(c, left=left, cacheable=True, cache=cache_count).first()[c]
elif dbset._db._adapter.dbengine == 'google:datastore':
#if we don't set a limit, this can timeout for a large table
# if we don't set a limit, this can timeout for a large table
nrows = dbset.db._adapter.count(dbset.query, limit=1000)
else:
nrows = dbset.count(cache=cache_count)
@@ -2292,20 +2292,20 @@ class SQLFORM(FORM):
ondelete(table, request.args[-1])
record.delete_record()
if request.ajax:
#this means javascript is enabled, so we don't need to do
#a redirect
# this means javascript is enabled, so we don't need to do
# a redirect
if not client_side_delete:
#if it's an ajax request and we don't need to reload the
#entire page, let's just inform that there have been no
#exceptions and don't regenerate the grid
# if it's an ajax request and we don't need to reload the
# entire page, let's just inform that there have been no
# exceptions and don't regenerate the grid
raise HTTP(200)
else:
#if it's requested that the grid gets reloaded on delete
#on ajax, the redirect should be on the original location
# if it's requested that the grid gets reloaded on delete
# on ajax, the redirect should be on the original location
newloc = request.env.http_web2py_component_location
redirect(newloc, client_side=client_side_delete)
else:
#we need to do a redirect because javascript is not enabled
# we need to do a redirect because javascript is not enabled
redirect(referrer, client_side=client_side_delete)
exportManager = dict(
@@ -3082,23 +3082,22 @@ class SQLTABLE(TABLE):
"""
def __init__(
self,
sqlrows,
linkto=None,
upload=None,
orderby=None,
headers={},
truncate=16,
columns=None,
th_link='',
extracolumns=None,
selectid=None,
renderstyle=False,
cid=None,
colgroup=False,
**attributes
):
def __init__(self,
sqlrows,
linkto=None,
upload=None,
orderby=None,
headers={},
truncate=16,
columns=None,
th_link='',
extracolumns=None,
selectid=None,
renderstyle=False,
cid=None,
colgroup=False,
**attributes
):
TABLE.__init__(self, **attributes)
+6
View File
@@ -0,0 +1,6 @@
read -p "Please choose a Web2Py Administrator password:" passwd
echo "web: python web2py.py -a '$passwd' -i 0.0.0.0 -p \$PORT" > Procfile
mkdir vendor
pip install --download vendor -r requirements.txt
read -p "Please choose a CF application name:" appname
cf push $appname -b https://github.com/cloudfoundry/buildpack-python.git