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(): def data():
if not session.m or len(session.m) == 10: if not session.m:
session.m = [] session.m = []
if request.vars.q: if request.vars.q:
if len(session.m) == 10:
del(session.m[0])
session.m.append(request.vars.q) session.m.append(request.vars.q)
session.m.sort() return TABLE(*[TR(v) for v in sorted(session.m)]).xml()
return TABLE(*[TR(v) for v in session.m]).xml()
def flash(): def flash():
+2
View File
@@ -120,6 +120,8 @@ def _():
'http://www.web2py.com/book/default/chapter/13'), 'http://www.web2py.com/book/default/chapter/13'),
(T('Other Recipes'), False, (T('Other Recipes'), False,
'http://www.web2py.com/book/default/chapter/14'), '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, (T("Buy web2py's book"), False,
'http://stores.lulu.com/web2py'), '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> </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':}}
+2 -1
View File
@@ -166,7 +166,8 @@ class RestrictedError(Exception):
} }
ticket_storage = TicketStorage(db=request.tickets_db) ticket_storage = TicketStorage(db=request.tickets_db)
ticket_storage.store(request, request.uuid.split('/', 1)[1], d) 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) logger.error(self.traceback)
return request.uuid return request.uuid
except: except:
+32 -33
View File
@@ -903,7 +903,7 @@ def formstyle_bootstrap3_inline_factory(col_label_size=3):
label['_for'] = None label['_for'] = None
label.insert(0, controls) label.insert(0, controls)
_controls = DIV(DIV(label, _help, _class="checkbox"), _controls = DIV(DIV(label, _help, _class="checkbox"),
_class="%s %s" % (offset_class, col_class)) _class="%s %s" % (offset_class, col_class))
label = '' label = ''
elif isinstance(controls, (SELECT, TEXTAREA)): elif isinstance(controls, (SELECT, TEXTAREA)):
controls.add_class('form-control') controls.add_class('form-control')
@@ -1590,7 +1590,7 @@ class SQLFORM(FORM):
(cStringIO.StringIO(f), 'file.txt') (cStringIO.StringIO(f), 'file.txt')
else: else:
# this should never happen, why does it happen? # this should never happen, why does it happen?
# print 'f=',repr(f) # print 'f=', repr(f)
continue continue
newfilename = field.store(source_file, original_filename, newfilename = field.store(source_file, original_filename,
field.uploadfolder) field.uploadfolder)
@@ -1827,16 +1827,16 @@ class SQLFORM(FORM):
else: else:
field_type = field.type 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) _id = "%s_%s" % (value_id, name)
if field_type in ['boolean', 'double', 'time', 'integer']: 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': elif field_type == 'date':
iso_format = {'_data-w2p_date_format' : '%Y-%m-%d'} 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': elif field_type == 'datetime':
iso_format = {'_data-w2p_datetime_format' : '%Y-%m-%d %H:%M:%S'} 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 elif (field_type.startswith('reference ') or
field_type.startswith('list:reference ')) and \ field_type.startswith('list:reference ')) and \
hasattr(field.requires, 'options'): hasattr(field.requires, 'options'):
@@ -1848,7 +1848,7 @@ class SQLFORM(FORM):
elif field_type.startswith('reference ') or \ elif field_type.startswith('reference ') or \
field_type.startswith('list:integer') or \ field_type.startswith('list:integer') or \
field_type.startswith('list:reference '): 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: else:
value_input = INPUT( value_input = INPUT(
_type='text', _id=_id, _type='text', _id=_id,
@@ -2041,7 +2041,7 @@ class SQLFORM(FORM):
c = 'count(*)' c = 'count(*)'
nrows = dbset.select(c, left=left, cacheable=True, cache=cache_count).first()[c] nrows = dbset.select(c, left=left, cacheable=True, cache=cache_count).first()[c]
elif dbset._db._adapter.dbengine == 'google:datastore': 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) nrows = dbset.db._adapter.count(dbset.query, limit=1000)
else: else:
nrows = dbset.count(cache=cache_count) nrows = dbset.count(cache=cache_count)
@@ -2292,20 +2292,20 @@ class SQLFORM(FORM):
ondelete(table, request.args[-1]) ondelete(table, request.args[-1])
record.delete_record() record.delete_record()
if request.ajax: if request.ajax:
#this means javascript is enabled, so we don't need to do # this means javascript is enabled, so we don't need to do
#a redirect # a redirect
if not client_side_delete: if not client_side_delete:
#if it's an ajax request and we don't need to reload the # 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 # entire page, let's just inform that there have been no
#exceptions and don't regenerate the grid # exceptions and don't regenerate the grid
raise HTTP(200) raise HTTP(200)
else: else:
#if it's requested that the grid gets reloaded on delete # if it's requested that the grid gets reloaded on delete
#on ajax, the redirect should be on the original location # on ajax, the redirect should be on the original location
newloc = request.env.http_web2py_component_location newloc = request.env.http_web2py_component_location
redirect(newloc, client_side=client_side_delete) redirect(newloc, client_side=client_side_delete)
else: 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) redirect(referrer, client_side=client_side_delete)
exportManager = dict( exportManager = dict(
@@ -3082,23 +3082,22 @@ class SQLTABLE(TABLE):
""" """
def __init__( def __init__(self,
self, sqlrows,
sqlrows, linkto=None,
linkto=None, upload=None,
upload=None, orderby=None,
orderby=None, headers={},
headers={}, truncate=16,
truncate=16, columns=None,
columns=None, th_link='',
th_link='', extracolumns=None,
extracolumns=None, selectid=None,
selectid=None, renderstyle=False,
renderstyle=False, cid=None,
cid=None, colgroup=False,
colgroup=False, **attributes
**attributes ):
):
TABLE.__init__(self, **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