fixws and 'new' button in grid query

This commit is contained in:
Massimo Di Pierro
2011-12-05 11:39:42 -06:00
parent 01f6f82cdf
commit d281acb421
305 changed files with 8352 additions and 8032 deletions
+7 -5
View File
@@ -349,7 +349,7 @@ def ccache():
seconds = math.floor(seconds)
return (hours, minutes, seconds)
for key, value in cache.ram.storage.items():
if isinstance(value, dict):
ram['hits'] = value['hit_total'] - value['misses']
@@ -388,7 +388,7 @@ def ccache():
if value[0] < disk['oldest']:
disk['oldest'] = value[0]
disk['keys'].append((key, GetInHMS(time.time() - value[0])))
finally:
portalocker.unlock(locker)
locker.close()
@@ -417,14 +417,16 @@ def ccache():
def key_table(keys):
return TABLE(
TR(TD(B('Key')), TD(B('Time in Cache (h:m:s)'))),
*[TR(TD(k[0]), TD('%02d:%02d:%02d' % k[1])) for k in keys],
*[TR(TD(k[0]), TD('%02d:%02d:%02d' % k[1])) for k in keys],
**dict(_class='cache-keys',
_style="border-collapse: separate; border-spacing: .5em;"))
ram['keys'] = key_table(ram['keys'])
disk['keys'] = key_table(disk['keys'])
total['keys'] = key_table(total['keys'])
return dict(form=form, total=total,
ram=ram, disk=disk, object_stats=hp != False)
+2
View File
@@ -31,3 +31,5 @@ def reset():
session['debug_commands:'+app] = []
return 'done'
+14 -12
View File
@@ -271,7 +271,7 @@ def uninstall():
else:
session.flash = T('no permission to uninstall "%s"', app)
redirect(URL('site'))
if app_uninstall(app, request):
if app_uninstall(app, request):
session.flash = T('application "%s" uninstalled', app)
else:
session.flash = T('unable to uninstall "%s"', app)
@@ -946,7 +946,7 @@ def create_file():
raise SyntaxError
msg = T('This is the %(filename)s template',
dict(filename=filename))
dict(filename=filename))
if extension == 'html':
text = dedent("""
{{extend 'layout.html'}}
@@ -958,7 +958,7 @@ def create_file():
text = read_file(generic)
else:
text = ''
elif path[-9:] == '/modules/':
if request.vars.plugin and not filename.startswith('plugin_%s/' % request.vars.plugin):
filename = 'plugin_%s/%s' % (request.vars.plugin, filename)
@@ -1103,27 +1103,27 @@ def errors():
decorated.sort(key=operator.itemgetter(0), reverse=True)
return dict(errors = [x[1] for x in decorated], app=app, method=method)
elif method == 'dbnew':
errors_path = apath('%s/errors' % app, r=request)
tk_db, tk_table = get_ticket_storage(app)
delete_hashes = []
for item in request.vars:
if item[:7] == 'delete_':
delete_hashes.append(item[7:])
hash2error = dict()
for fn in tk_db(tk_table.id>0).select():
try:
error = pickle.loads(fn.ticket_data)
except AttributeError:
tk_db(tk_table.id == fn.id).delete()
tk_db.commit()
hash = hashlib.md5(error['traceback']).hexdigest()
if hash in delete_hashes:
tk_db(tk_table.id == fn.id).delete()
tk_db.commit()
@@ -1140,9 +1140,9 @@ def errors():
hash=hash,ticket=fn.ticket_id)
decorated = [(x['count'], x) for x in hash2error.values()]
decorated.sort(key=operator.itemgetter(0), reverse=True)
return dict(errors = [x[1] for x in decorated], app=app, method=method)
elif method == 'dbold':
@@ -1153,7 +1153,7 @@ def errors():
tk_db.commit()
tickets_ = tk_db(tk_table.id>0).select(tk_table.ticket_id, tk_table.created_datetime, orderby=~tk_table.created_datetime)
tickets = [row.ticket_id for row in tickets_]
times = dict([(row.ticket_id, row.created_datetime) for row in tickets_])
times = dict([(row.ticket_id, row.created_datetime) for row in tickets_])
return dict(app=app, tickets=tickets, method=method, times=times)
@@ -1323,7 +1323,7 @@ def twitter():
def user():
if MULTI_USER_MODE:
if not db(db.auth_user).count():
auth.settings.registration_requires_approval = False
auth.settings.registration_requires_approval = False
return dict(form=auth())
else:
return dict(form=T("Disabled"))
@@ -1333,3 +1333,5 @@ def reload_routes():
import gluon.rewrite
gluon.rewrite.load()
redirect(URL('site'))
+4 -2
View File
@@ -7,7 +7,7 @@ try:
import signal
import os
import shutil
from gluon.fileutils import read_file, write_file
from gluon.fileutils import read_file, write_file
except:
session.flash='sorry, only on Unix systems'
redirect(URL(request.application,'default','site'))
@@ -53,7 +53,7 @@ def deploy():
yaml = apath('../app.yaml', r=request)
if not os.path.exists(yaml):
example = apath('../app.example.yaml', r=request)
shutil.copyfile(example,yaml)
shutil.copyfile(example,yaml)
data = read_file(yaml)
data = re.sub('application:.*','application: %s' % form.vars.google_application_id,data)
data = regex.sub('(applications/(%s)/.*)|' % '|'.join(ignore_apps),data)
@@ -85,3 +85,5 @@ def callback():
except:
errors=''
return (output+errors).replace('\n','<br/>')
@@ -80,3 +80,5 @@ def revision():
desc=ctx.description(),
form=form
)
@@ -6,3 +6,5 @@ def index():
def about():
return locals()
+2
View File
@@ -43,3 +43,5 @@ def reset():
session['commands:'+app] = []
session['history:'+app] = gluon.contrib.shell.History()
return 'done'
+4 -2
View File
@@ -20,10 +20,12 @@ def profiler():
size = 0
if os.path.exists(filename):
data = read_file('profiler.log','rb')
if size<len(data):
if size<len(data):
data = data[size:]
else:
else:
size=0
size += len(data)
response.cookies[KEY] = size
return data
+7 -5
View File
@@ -288,7 +288,7 @@ def make_table(table,fields):
'text':'text','file':'upload','image':'upload',
'upload':'upload','wiki':'text', 'html':'text'}
for key,t in deftypes.items():
if key in has:
if key in has:
ftype = t
if refs:
key = refs[0]
@@ -458,7 +458,7 @@ def create(options):
fn = 'web2py.plugin.layout_%s.w2p' % params['layout_theme']
theme = urllib.urlopen(LAYOUTS_APP+'/static/plugin_layouts/plugins/'+fn)
plugin_install(app, theme, request, fn)
except:
except:
session.flash = T("unable to download layout")
### apply plugins
@@ -467,9 +467,9 @@ def create(options):
plugin_name = 'web2py.plugin.'+plugin+'.w2p'
stream = urllib.urlopen(PLUGINS_APP+'/static/'+plugin_name)
plugin_install(app, stream, request, plugin_name)
except Exception, e:
except Exception, e:
session.flash = T("unable to download plugin: %s" % plugin)
### write configuration file into newapp/models/0.py
model = os.path.join(request.folder,'..',app,'models','0.py')
file = open(model, 'wb')
@@ -547,5 +547,7 @@ def call(): return service()
if options.erase_database:
path = os.path.join(request.folder,'..',app,'databases','*')
for file in glob.glob(path):
for file in glob.glob(path):
os.unlink(file)