Merge branch 'master' of git://github.com/web2py/web2py
This commit is contained in:
@@ -1 +1 @@
|
||||
Version 2.8.2-stable+timestamp.2013.12.17.16.49.17
|
||||
Version 2.8.2-stable+timestamp.2014.01.07.02.13.10
|
||||
|
||||
@@ -16,6 +16,8 @@ try:
|
||||
except ImportError:
|
||||
pgv = None
|
||||
|
||||
is_gae = request.env.web2py_runtime_gae or False
|
||||
|
||||
# ## critical --- make a copy of the environment
|
||||
|
||||
global_env = copy.copy(globals())
|
||||
@@ -359,36 +361,43 @@ def state():
|
||||
|
||||
|
||||
def ccache():
|
||||
cache.ram.initialize()
|
||||
cache.disk.initialize()
|
||||
if is_gae:
|
||||
form = FORM(
|
||||
P(TAG.BUTTON(T("Clear CACHE?"), _type="submit", _name="yes", _value="yes")))
|
||||
else:
|
||||
cache.ram.initialize()
|
||||
cache.disk.initialize()
|
||||
|
||||
form = FORM(
|
||||
P(TAG.BUTTON(
|
||||
T("Clear CACHE?"), _type="submit", _name="yes", _value="yes")),
|
||||
P(TAG.BUTTON(
|
||||
T("Clear RAM"), _type="submit", _name="ram", _value="ram")),
|
||||
P(TAG.BUTTON(
|
||||
T("Clear DISK"), _type="submit", _name="disk", _value="disk")),
|
||||
)
|
||||
form = FORM(
|
||||
P(TAG.BUTTON(
|
||||
T("Clear CACHE?"), _type="submit", _name="yes", _value="yes")),
|
||||
P(TAG.BUTTON(
|
||||
T("Clear RAM"), _type="submit", _name="ram", _value="ram")),
|
||||
P(TAG.BUTTON(
|
||||
T("Clear DISK"), _type="submit", _name="disk", _value="disk")),
|
||||
)
|
||||
|
||||
if form.accepts(request.vars, session):
|
||||
clear_ram = False
|
||||
clear_disk = False
|
||||
session.flash = ""
|
||||
if request.vars.yes:
|
||||
clear_ram = clear_disk = True
|
||||
if request.vars.ram:
|
||||
clear_ram = True
|
||||
if request.vars.disk:
|
||||
clear_disk = True
|
||||
|
||||
if clear_ram:
|
||||
cache.ram.clear()
|
||||
session.flash += T("Ram Cleared")
|
||||
if clear_disk:
|
||||
cache.disk.clear()
|
||||
session.flash += T("Disk Cleared")
|
||||
|
||||
if is_gae:
|
||||
if request.vars.yes:
|
||||
cache.ram.clear()
|
||||
session.flash += T("Cache Cleared")
|
||||
else:
|
||||
clear_ram = False
|
||||
clear_disk = False
|
||||
if request.vars.yes:
|
||||
clear_ram = clear_disk = True
|
||||
if request.vars.ram:
|
||||
clear_ram = True
|
||||
if request.vars.disk:
|
||||
clear_disk = True
|
||||
if clear_ram:
|
||||
cache.ram.clear()
|
||||
session.flash += T("Ram Cleared")
|
||||
if clear_disk:
|
||||
cache.disk.clear()
|
||||
session.flash += T("Disk Cleared")
|
||||
redirect(URL(r=request))
|
||||
|
||||
try:
|
||||
@@ -414,6 +423,7 @@ def ccache():
|
||||
'oldest': time.time(),
|
||||
'keys': []
|
||||
}
|
||||
|
||||
disk = copy.copy(ram)
|
||||
total = copy.copy(ram)
|
||||
disk['keys'] = []
|
||||
@@ -428,72 +438,81 @@ def ccache():
|
||||
|
||||
return (hours, minutes, seconds)
|
||||
|
||||
for key, value in cache.ram.storage.iteritems():
|
||||
if isinstance(value, dict):
|
||||
ram['hits'] = value['hit_total'] - value['misses']
|
||||
ram['misses'] = value['misses']
|
||||
try:
|
||||
ram['ratio'] = ram['hits'] * 100 / value['hit_total']
|
||||
except (KeyError, ZeroDivisionError):
|
||||
ram['ratio'] = 0
|
||||
else:
|
||||
if hp:
|
||||
ram['bytes'] += hp.iso(value[1]).size
|
||||
ram['objects'] += hp.iso(value[1]).count
|
||||
ram['entries'] += 1
|
||||
if value[0] < ram['oldest']:
|
||||
ram['oldest'] = value[0]
|
||||
ram['keys'].append((key, GetInHMS(time.time() - value[0])))
|
||||
folder = os.path.join(request.folder,'cache')
|
||||
if not os.path.exists(folder):
|
||||
os.mkdir(folder)
|
||||
locker = open(os.path.join(folder, 'cache.lock'), 'a')
|
||||
portalocker.lock(locker, portalocker.LOCK_EX)
|
||||
disk_storage = shelve.open(
|
||||
os.path.join(folder, 'cache.shelve'))
|
||||
try:
|
||||
for key, value in disk_storage.items():
|
||||
if is_gae:
|
||||
gae_stats = cache.ram.client.get_stats()
|
||||
try:
|
||||
gae_stats['ratio'] = ((gae_stats['hits'] * 100) /
|
||||
(gae_stats['hits'] + gae_stats['misses']))
|
||||
except ZeroDivisionError:
|
||||
gae_stats['ratio'] = T("?")
|
||||
gae_stats['oldest'] = GetInHMS(time.time() - gae_stats['oldest_item_age'])
|
||||
total.update(gae_stats)
|
||||
else:
|
||||
for key, value in cache.ram.storage.iteritems():
|
||||
if isinstance(value, dict):
|
||||
disk['hits'] = value['hit_total'] - value['misses']
|
||||
disk['misses'] = value['misses']
|
||||
ram['hits'] = value['hit_total'] - value['misses']
|
||||
ram['misses'] = value['misses']
|
||||
try:
|
||||
disk['ratio'] = disk['hits'] * 100 / value['hit_total']
|
||||
ram['ratio'] = ram['hits'] * 100 / value['hit_total']
|
||||
except (KeyError, ZeroDivisionError):
|
||||
disk['ratio'] = 0
|
||||
ram['ratio'] = 0
|
||||
else:
|
||||
if hp:
|
||||
disk['bytes'] += hp.iso(value[1]).size
|
||||
disk['objects'] += hp.iso(value[1]).count
|
||||
disk['entries'] += 1
|
||||
if value[0] < disk['oldest']:
|
||||
disk['oldest'] = value[0]
|
||||
disk['keys'].append((key, GetInHMS(time.time() - value[0])))
|
||||
ram['bytes'] += hp.iso(value[1]).size
|
||||
ram['objects'] += hp.iso(value[1]).count
|
||||
ram['entries'] += 1
|
||||
if value[0] < ram['oldest']:
|
||||
ram['oldest'] = value[0]
|
||||
ram['keys'].append((key, GetInHMS(time.time() - value[0])))
|
||||
folder = os.path.join(request.folder,'cache')
|
||||
if not os.path.exists(folder):
|
||||
os.mkdir(folder)
|
||||
locker = open(os.path.join(folder, 'cache.lock'), 'a')
|
||||
portalocker.lock(locker, portalocker.LOCK_EX)
|
||||
disk_storage = shelve.open(
|
||||
os.path.join(folder, 'cache.shelve'))
|
||||
try:
|
||||
for key, value in disk_storage.items():
|
||||
if isinstance(value, dict):
|
||||
disk['hits'] = value['hit_total'] - value['misses']
|
||||
disk['misses'] = value['misses']
|
||||
try:
|
||||
disk['ratio'] = disk['hits'] * 100 / value['hit_total']
|
||||
except (KeyError, ZeroDivisionError):
|
||||
disk['ratio'] = 0
|
||||
else:
|
||||
if hp:
|
||||
disk['bytes'] += hp.iso(value[1]).size
|
||||
disk['objects'] += hp.iso(value[1]).count
|
||||
disk['entries'] += 1
|
||||
if value[0] < disk['oldest']:
|
||||
disk['oldest'] = value[0]
|
||||
disk['keys'].append((key, GetInHMS(time.time() - value[0])))
|
||||
finally:
|
||||
portalocker.unlock(locker)
|
||||
locker.close()
|
||||
disk_storage.close()
|
||||
|
||||
finally:
|
||||
portalocker.unlock(locker)
|
||||
locker.close()
|
||||
disk_storage.close()
|
||||
|
||||
total['entries'] = ram['entries'] + disk['entries']
|
||||
total['bytes'] = ram['bytes'] + disk['bytes']
|
||||
total['objects'] = ram['objects'] + disk['objects']
|
||||
total['hits'] = ram['hits'] + disk['hits']
|
||||
total['misses'] = ram['misses'] + disk['misses']
|
||||
total['keys'] = ram['keys'] + disk['keys']
|
||||
try:
|
||||
total['ratio'] = total['hits'] * 100 / (total['hits'] +
|
||||
total['entries'] = ram['entries'] + disk['entries']
|
||||
total['bytes'] = ram['bytes'] + disk['bytes']
|
||||
total['objects'] = ram['objects'] + disk['objects']
|
||||
total['hits'] = ram['hits'] + disk['hits']
|
||||
total['misses'] = ram['misses'] + disk['misses']
|
||||
total['keys'] = ram['keys'] + disk['keys']
|
||||
try:
|
||||
total['ratio'] = total['hits'] * 100 / (total['hits'] +
|
||||
total['misses'])
|
||||
except (KeyError, ZeroDivisionError):
|
||||
total['ratio'] = 0
|
||||
except (KeyError, ZeroDivisionError):
|
||||
total['ratio'] = 0
|
||||
|
||||
if disk['oldest'] < ram['oldest']:
|
||||
total['oldest'] = disk['oldest']
|
||||
else:
|
||||
total['oldest'] = ram['oldest']
|
||||
if disk['oldest'] < ram['oldest']:
|
||||
total['oldest'] = disk['oldest']
|
||||
else:
|
||||
total['oldest'] = ram['oldest']
|
||||
|
||||
ram['oldest'] = GetInHMS(time.time() - ram['oldest'])
|
||||
disk['oldest'] = GetInHMS(time.time() - disk['oldest'])
|
||||
total['oldest'] = GetInHMS(time.time() - total['oldest'])
|
||||
ram['oldest'] = GetInHMS(time.time() - ram['oldest'])
|
||||
disk['oldest'] = GetInHMS(time.time() - disk['oldest'])
|
||||
total['oldest'] = GetInHMS(time.time() - total['oldest'])
|
||||
|
||||
def key_table(keys):
|
||||
return TABLE(
|
||||
@@ -502,9 +521,10 @@ def ccache():
|
||||
**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'])
|
||||
if not is_gae:
|
||||
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)
|
||||
|
||||
@@ -574,10 +574,10 @@ def edit():
|
||||
# Load json only if it is ajax edited...
|
||||
app = get_app(request.vars.app)
|
||||
app_path = apath(app, r=request)
|
||||
editor_defaults={'theme':'web2py', 'editor': 'default', 'closetag': 'true', 'codefolding': 'false', 'tabwidth':'4', 'indentwithtabs':'false', 'linenumbers':'true', 'highlightline':'true'}
|
||||
preferences={'theme':'web2py', 'editor': 'default', 'closetag': 'true', 'codefolding': 'false', 'tabwidth':'4', 'indentwithtabs':'false', 'linenumbers':'true', 'highlightline':'true'}
|
||||
config = Config(os.path.join(request.folder, 'settings.cfg'),
|
||||
section='editor', default_values=editor_defaults)
|
||||
preferences = config.read()
|
||||
section='editor', default_values={})
|
||||
preferences.update(config.read())
|
||||
|
||||
if not(request.ajax) and not(is_mobile):
|
||||
# return the scaffolding, the rest will be through ajax requests
|
||||
@@ -589,7 +589,7 @@ def edit():
|
||||
if request.post_vars: #save new preferences
|
||||
post_vars = request.post_vars.items()
|
||||
# Since unchecked checkbox are not serialized, we must set them as false by hand to store the correct preference in the settings
|
||||
post_vars+= [(opt, 'false') for opt in editor_defaults if opt not in request.post_vars ]
|
||||
post_vars+= [(opt, 'false') for opt in preferences if opt not in request.post_vars ]
|
||||
if config.save(post_vars):
|
||||
response.headers["web2py-component-flash"] = T('Preferences saved correctly')
|
||||
else:
|
||||
@@ -814,6 +814,22 @@ def todolist():
|
||||
|
||||
return {'todo':output, 'app': app}
|
||||
|
||||
def editor_sessions():
|
||||
config = Config(os.path.join(request.folder, 'settings.cfg'),
|
||||
section='editor_sessions', default_values={})
|
||||
preferences = config.read()
|
||||
|
||||
if request.vars.session_name and request.vars.files:
|
||||
session_name = request.vars.session_name
|
||||
files = request.vars.files
|
||||
preferences.update({session_name:','.join(files)})
|
||||
if config.save(preferences.items()):
|
||||
response.headers["web2py-component-flash"] = T('Session saved correctly')
|
||||
else:
|
||||
response.headers["web2py-component-flash"] = T('Session saved on session only')
|
||||
|
||||
return response.render('default/editor_sessions.html', {'editor_sessions':preferences})
|
||||
|
||||
def resolve():
|
||||
"""
|
||||
"""
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
'(version %s)': '(version %s)',
|
||||
'@markmin\x01(file **gluon/contrib/plural_rules/%s.py** is not found)': '(file **gluon/contrib/plural_rules/%s.py** is not found)',
|
||||
'@markmin\x01An error occured, please [[reload %s]] the page': 'An error occured, please [[reload %s]] the page',
|
||||
'@markmin\x01Number of entries: **%s**': 'Number of entries: **%s**',
|
||||
'@markmin\x01Searching: **%s** %%{file}': 'Searching: **%s** files',
|
||||
'A new version of web2py is available': 'Hay una nueva versión de web2py disponible',
|
||||
'A new version of web2py is available: %s': 'Hay una nueva versión de web2py disponible: %s',
|
||||
@@ -57,11 +58,13 @@
|
||||
'Autocomplete': 'Autocomplete',
|
||||
'Autocomplete Python Code': 'Autocompletar código Python',
|
||||
'Available databases and tables': 'Bases de datos y tablas disponibles',
|
||||
'Available Databases and Tables': 'Available Databases and Tables',
|
||||
'back': 'atrás',
|
||||
'Back to the plugins list': 'Back to the plugins list',
|
||||
'breakpoint': 'breakpoint',
|
||||
'breakpoints': 'breakpoints',
|
||||
'browse': 'buscar',
|
||||
'Cache': 'Cache',
|
||||
'cache': 'cache',
|
||||
'cache, errors and sessions cleaned': 'cache, errores y sesiones eliminados',
|
||||
'can be a git repo': 'puede ser un repositorio git',
|
||||
@@ -79,6 +82,9 @@
|
||||
'Check to delete': 'Marque para eliminar',
|
||||
'Checking for upgrades...': 'Buscando actulizaciones...',
|
||||
'Clean': 'limpiar',
|
||||
'Clear CACHE?': 'Clear CACHE?',
|
||||
'Clear DISK': 'Clear DISK',
|
||||
'Clear RAM': 'Clear RAM',
|
||||
'click here for online examples': 'haga clic aquí para ver ejemplos en línea',
|
||||
'click here for the administrative interface': 'haga clic aquí para usar la interfaz administrativa',
|
||||
'Click row to expand traceback': 'Click row to expand traceback',
|
||||
@@ -113,6 +119,7 @@
|
||||
'database': 'base de datos',
|
||||
'database %s select': 'selección en base de datos %s',
|
||||
'database administration': 'administración base de datos',
|
||||
'Database Administration (appadmin)': 'Database Administration (appadmin)',
|
||||
'Date and Time': 'Fecha y Hora',
|
||||
'db': 'db',
|
||||
'Debug': 'Debug',
|
||||
@@ -135,6 +142,7 @@
|
||||
'details': 'detalles',
|
||||
'direction: ltr': 'direction: ltr',
|
||||
'Disable': 'Deshabilitar',
|
||||
'DISK': 'DISK',
|
||||
'docs': 'docs',
|
||||
'Docs': 'Docs',
|
||||
'Done!': 'Done!',
|
||||
@@ -249,6 +257,7 @@
|
||||
'Lost Password': 'Contraseña perdida',
|
||||
'manage': 'gestionar',
|
||||
'Manage': 'Gestionar',
|
||||
'Manage Cache': 'Manage Cache',
|
||||
'merge': 'combinar',
|
||||
'Models': 'Modelos',
|
||||
'models': 'modelos',
|
||||
@@ -282,6 +291,7 @@
|
||||
'or provide application url:': 'o provea URL de la aplicación:',
|
||||
'Origin': 'Origen',
|
||||
'Original/Translation': 'Original/Traducción',
|
||||
'Overview': 'Overview',
|
||||
'Overwrite installed app': 'sobreescriba la aplicación instalada',
|
||||
'Pack all': 'empaquetar todo',
|
||||
'Pack compiled': 'empaquete compiladas',
|
||||
@@ -305,6 +315,7 @@
|
||||
'private files': 'archivos privados',
|
||||
'Project Progress': 'Project Progress',
|
||||
'Query:': 'Consulta:',
|
||||
'RAM': 'RAM',
|
||||
'Rapid Search': 'Rapid Search',
|
||||
'record': 'registro',
|
||||
'record does not exist': 'el registro no existe',
|
||||
@@ -356,6 +367,7 @@
|
||||
'Static': 'Static',
|
||||
'static': 'estáticos',
|
||||
'Static files': 'Archivos estáticos',
|
||||
'Statistics': 'Statistics',
|
||||
'step': 'step',
|
||||
'stop': 'stop',
|
||||
'submit': 'enviar',
|
||||
@@ -397,6 +409,7 @@
|
||||
'To emulate a breakpoint programatically, write:': 'To emulate a breakpoint programatically, write:',
|
||||
'to use the debugger!': 'to use the debugger!',
|
||||
'toggle breakpoint': 'alternar punto de ruptura',
|
||||
'Toggle comment': 'Toggle comment',
|
||||
'Toggle Fullscreen': 'Alternar pantalla completa',
|
||||
'Traceback': 'Traceback',
|
||||
'translation strings for the application': 'cadenas de caracteres de traducción para la aplicación',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# coding: utf8
|
||||
# -*- coding: utf-8 -*-
|
||||
{
|
||||
'!langcode!': 'it',
|
||||
'!langname!': 'Italiano',
|
||||
@@ -303,6 +303,7 @@
|
||||
'to previous version.': 'torna a versione precedente',
|
||||
'To create a plugin, name a file/folder plugin_[name]': 'Per creare un plugin, chiamare un file o cartella plugin_[nome]',
|
||||
'toggle breakpoint': 'toggle breakpoint',
|
||||
'Toggle comment': 'Toggle comment',
|
||||
'Toggle Fullscreen': 'Toggle Fullscreen',
|
||||
'Traceback': 'Traceback',
|
||||
'translation strings for the application': "stringhe di traduzioni per l'applicazione",
|
||||
|
||||
@@ -45,4 +45,4 @@ if 'adminLanguage' in request.cookies and not (request.cookies['adminLanguage']
|
||||
T.force(request.cookies['adminLanguage'].value)
|
||||
|
||||
#set static_version
|
||||
response.static_version = '2.7.3'
|
||||
response.static_version = open('VERSION').read().split(' ',1)[1].split('-')[0]
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
[DEFAULT]
|
||||
theme = web2py
|
||||
closetag = true
|
||||
editor = default
|
||||
|
||||
[editor]
|
||||
theme = web2py
|
||||
editor = default
|
||||
closetag = true
|
||||
|
||||
[editor_sessions]
|
||||
welcome = welcome/models/db.py,welcome/controllers/default.py,welcome/views/default/index.html
|
||||
|
||||
|
||||
@@ -260,7 +260,7 @@ function load_file(url, lineno) {
|
||||
if(typeof (json['plain_html']) !== undefined) {
|
||||
if($('#' + json['id']).length === 0 || json['force'] === true) {
|
||||
// Create a tab and put the code in it
|
||||
var tab_header = '<li><a title="'+ json['filename'] +'" href="#' + json['id'] + '" data-toggle="tab"><button type="button" class="close">×</button>' + json['realfilename'] + '</a></li>';
|
||||
var tab_header = '<li><a title="'+ json['filename'] +'" data-path="' + json['filename'] + '" href="#' + json['id'] + '" data-toggle="tab"><button type="button" class="close">×</button>' + json['realfilename'] + '</a></li>';
|
||||
var tab_body = '<div id="' + json['id'] + '" class="tab-pane fade in " >' + json['plain_html'] + '</div>';
|
||||
if(json['force'] === false) {
|
||||
$('#myTabContent').append($(tab_body)); // First load the body
|
||||
|
||||
@@ -20,14 +20,14 @@ jQuery(function(){
|
||||
function hoverMenu(){
|
||||
jQuery('ul.nav a.dropdown-toggle').parent().hover(function(){
|
||||
adjust_height_of_collapsed_nav();
|
||||
mi = jQuery(this).addClass('open');
|
||||
var mi = jQuery(this).addClass('open');
|
||||
mi.children('.dropdown-menu').stop(true, true).delay(200).fadeIn(400);
|
||||
}, function(){
|
||||
mi = jQuery(this);
|
||||
var mi = jQuery(this);
|
||||
mi.children('.dropdown-menu').stop(true, true).delay(200).fadeOut(function(){mi.removeClass('open')});
|
||||
});
|
||||
}
|
||||
hoverMenu(); // first page load
|
||||
jQuery(window).resize(hoverMenu); // on resize event
|
||||
jQuery('ul.nav li.dropdown a').click(function(){window.location=jQuery(this).attr('href');});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -116,13 +116,15 @@
|
||||
|
||||
|
||||
{{elif request.function == 'ccache':}}
|
||||
<h2>{{T("Cache")}}</h2>
|
||||
<div class="list">
|
||||
|
||||
<h2>{{=T("Cache")}}</h2>
|
||||
<div class="list-header">
|
||||
<h3>{{T("Statistics")}}</h3>
|
||||
<h3>{{=T("Statistics")}}</h3>
|
||||
</div>
|
||||
|
||||
{{if request.env.web2py_runtime_gae:}}
|
||||
{{=BEAUTIFY(total)}}
|
||||
{{else:}}
|
||||
<div class="list">
|
||||
<div class="content">
|
||||
<h4>{{=T("Overview")}}</h4>
|
||||
<p>{{=T.M("Number of entries: **%s**", total['entries'])}}</p>
|
||||
@@ -210,6 +212,8 @@
|
||||
{{pass}}
|
||||
</div>
|
||||
|
||||
{{pass}}
|
||||
|
||||
<div class="list-header">
|
||||
<h3>{{=T("Manage Cache")}}</h3>
|
||||
</div>
|
||||
|
||||
@@ -208,6 +208,9 @@ $(document).on('click', 'a.font_button', function (e) {
|
||||
|
||||
<div class='row-fluid'>
|
||||
<div class="right controls btn-toolbar pull-right">
|
||||
|
||||
{{=LOAD('default', 'editor_sessions', ajax=True, _class='btn-group')}}
|
||||
|
||||
<div class="btn-group">
|
||||
<a class="button btn" onclick="$('#files').toggle(); return false" href="#">Files toggle</a>
|
||||
</div>
|
||||
@@ -314,5 +317,28 @@ $(document).ready(function() {
|
||||
load_file(datum.link);
|
||||
$(this).val('');
|
||||
});
|
||||
/* handlers to manage editor sessions
|
||||
*/
|
||||
$(document).on('click', '#save_session', function(e) {
|
||||
e.preventDefault();
|
||||
var session_name=prompt("Session name","{{=app}}");
|
||||
|
||||
if (session_name!==null) {
|
||||
files = $("[data-path]").map(function(){return $(this).data("path");}).get();
|
||||
data = JSON.stringify({ files: files, session_name:session_name});
|
||||
$.ajaxSetup({contentType: "application/json"});
|
||||
$.web2py.ajax_page("POST", "{{=URL('default', 'editor_sessions')}}", data, 'manage_sessions');
|
||||
}
|
||||
});
|
||||
$(document).on('click', '#saved_sessions a[data-files]', function(e) {
|
||||
e.preventDefault();
|
||||
files = $(this).data('files');
|
||||
array_files = files.split(',');
|
||||
$.each(array_files, function(index, value) {
|
||||
url = "{{=URL('default','edit')}}/" + value;
|
||||
load_file(url);
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
<!-- end "edit" block -->
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<div class="btn-group" id='manage_sessions'>
|
||||
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">Saved session <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu" id="saved_sessions">
|
||||
{{for name, files in editor_sessions.items():}}
|
||||
<li><a href="" data-files='{{=files}}'>{{=name}}</a></li>
|
||||
{{pass}}
|
||||
<li class="divider"></li>
|
||||
<li><a id="save_session" href="">Save current session</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -16,6 +16,8 @@ try:
|
||||
except ImportError:
|
||||
pgv = None
|
||||
|
||||
is_gae = request.env.web2py_runtime_gae or False
|
||||
|
||||
# ## critical --- make a copy of the environment
|
||||
|
||||
global_env = copy.copy(globals())
|
||||
@@ -359,36 +361,43 @@ def state():
|
||||
|
||||
|
||||
def ccache():
|
||||
cache.ram.initialize()
|
||||
cache.disk.initialize()
|
||||
if is_gae:
|
||||
form = FORM(
|
||||
P(TAG.BUTTON(T("Clear CACHE?"), _type="submit", _name="yes", _value="yes")))
|
||||
else:
|
||||
cache.ram.initialize()
|
||||
cache.disk.initialize()
|
||||
|
||||
form = FORM(
|
||||
P(TAG.BUTTON(
|
||||
T("Clear CACHE?"), _type="submit", _name="yes", _value="yes")),
|
||||
P(TAG.BUTTON(
|
||||
T("Clear RAM"), _type="submit", _name="ram", _value="ram")),
|
||||
P(TAG.BUTTON(
|
||||
T("Clear DISK"), _type="submit", _name="disk", _value="disk")),
|
||||
)
|
||||
form = FORM(
|
||||
P(TAG.BUTTON(
|
||||
T("Clear CACHE?"), _type="submit", _name="yes", _value="yes")),
|
||||
P(TAG.BUTTON(
|
||||
T("Clear RAM"), _type="submit", _name="ram", _value="ram")),
|
||||
P(TAG.BUTTON(
|
||||
T("Clear DISK"), _type="submit", _name="disk", _value="disk")),
|
||||
)
|
||||
|
||||
if form.accepts(request.vars, session):
|
||||
clear_ram = False
|
||||
clear_disk = False
|
||||
session.flash = ""
|
||||
if request.vars.yes:
|
||||
clear_ram = clear_disk = True
|
||||
if request.vars.ram:
|
||||
clear_ram = True
|
||||
if request.vars.disk:
|
||||
clear_disk = True
|
||||
|
||||
if clear_ram:
|
||||
cache.ram.clear()
|
||||
session.flash += T("Ram Cleared")
|
||||
if clear_disk:
|
||||
cache.disk.clear()
|
||||
session.flash += T("Disk Cleared")
|
||||
|
||||
if is_gae:
|
||||
if request.vars.yes:
|
||||
cache.ram.clear()
|
||||
session.flash += T("Cache Cleared")
|
||||
else:
|
||||
clear_ram = False
|
||||
clear_disk = False
|
||||
if request.vars.yes:
|
||||
clear_ram = clear_disk = True
|
||||
if request.vars.ram:
|
||||
clear_ram = True
|
||||
if request.vars.disk:
|
||||
clear_disk = True
|
||||
if clear_ram:
|
||||
cache.ram.clear()
|
||||
session.flash += T("Ram Cleared")
|
||||
if clear_disk:
|
||||
cache.disk.clear()
|
||||
session.flash += T("Disk Cleared")
|
||||
redirect(URL(r=request))
|
||||
|
||||
try:
|
||||
@@ -414,6 +423,7 @@ def ccache():
|
||||
'oldest': time.time(),
|
||||
'keys': []
|
||||
}
|
||||
|
||||
disk = copy.copy(ram)
|
||||
total = copy.copy(ram)
|
||||
disk['keys'] = []
|
||||
@@ -428,72 +438,81 @@ def ccache():
|
||||
|
||||
return (hours, minutes, seconds)
|
||||
|
||||
for key, value in cache.ram.storage.iteritems():
|
||||
if isinstance(value, dict):
|
||||
ram['hits'] = value['hit_total'] - value['misses']
|
||||
ram['misses'] = value['misses']
|
||||
try:
|
||||
ram['ratio'] = ram['hits'] * 100 / value['hit_total']
|
||||
except (KeyError, ZeroDivisionError):
|
||||
ram['ratio'] = 0
|
||||
else:
|
||||
if hp:
|
||||
ram['bytes'] += hp.iso(value[1]).size
|
||||
ram['objects'] += hp.iso(value[1]).count
|
||||
ram['entries'] += 1
|
||||
if value[0] < ram['oldest']:
|
||||
ram['oldest'] = value[0]
|
||||
ram['keys'].append((key, GetInHMS(time.time() - value[0])))
|
||||
folder = os.path.join(request.folder,'cache')
|
||||
if not os.path.exists(folder):
|
||||
os.mkdir(folder)
|
||||
locker = open(os.path.join(folder, 'cache.lock'), 'a')
|
||||
portalocker.lock(locker, portalocker.LOCK_EX)
|
||||
disk_storage = shelve.open(
|
||||
os.path.join(folder, 'cache.shelve'))
|
||||
try:
|
||||
for key, value in disk_storage.items():
|
||||
if is_gae:
|
||||
gae_stats = cache.ram.client.get_stats()
|
||||
try:
|
||||
gae_stats['ratio'] = ((gae_stats['hits'] * 100) /
|
||||
(gae_stats['hits'] + gae_stats['misses']))
|
||||
except ZeroDivisionError:
|
||||
gae_stats['ratio'] = T("?")
|
||||
gae_stats['oldest'] = GetInHMS(time.time() - gae_stats['oldest_item_age'])
|
||||
total.update(gae_stats)
|
||||
else:
|
||||
for key, value in cache.ram.storage.iteritems():
|
||||
if isinstance(value, dict):
|
||||
disk['hits'] = value['hit_total'] - value['misses']
|
||||
disk['misses'] = value['misses']
|
||||
ram['hits'] = value['hit_total'] - value['misses']
|
||||
ram['misses'] = value['misses']
|
||||
try:
|
||||
disk['ratio'] = disk['hits'] * 100 / value['hit_total']
|
||||
ram['ratio'] = ram['hits'] * 100 / value['hit_total']
|
||||
except (KeyError, ZeroDivisionError):
|
||||
disk['ratio'] = 0
|
||||
ram['ratio'] = 0
|
||||
else:
|
||||
if hp:
|
||||
disk['bytes'] += hp.iso(value[1]).size
|
||||
disk['objects'] += hp.iso(value[1]).count
|
||||
disk['entries'] += 1
|
||||
if value[0] < disk['oldest']:
|
||||
disk['oldest'] = value[0]
|
||||
disk['keys'].append((key, GetInHMS(time.time() - value[0])))
|
||||
ram['bytes'] += hp.iso(value[1]).size
|
||||
ram['objects'] += hp.iso(value[1]).count
|
||||
ram['entries'] += 1
|
||||
if value[0] < ram['oldest']:
|
||||
ram['oldest'] = value[0]
|
||||
ram['keys'].append((key, GetInHMS(time.time() - value[0])))
|
||||
folder = os.path.join(request.folder,'cache')
|
||||
if not os.path.exists(folder):
|
||||
os.mkdir(folder)
|
||||
locker = open(os.path.join(folder, 'cache.lock'), 'a')
|
||||
portalocker.lock(locker, portalocker.LOCK_EX)
|
||||
disk_storage = shelve.open(
|
||||
os.path.join(folder, 'cache.shelve'))
|
||||
try:
|
||||
for key, value in disk_storage.items():
|
||||
if isinstance(value, dict):
|
||||
disk['hits'] = value['hit_total'] - value['misses']
|
||||
disk['misses'] = value['misses']
|
||||
try:
|
||||
disk['ratio'] = disk['hits'] * 100 / value['hit_total']
|
||||
except (KeyError, ZeroDivisionError):
|
||||
disk['ratio'] = 0
|
||||
else:
|
||||
if hp:
|
||||
disk['bytes'] += hp.iso(value[1]).size
|
||||
disk['objects'] += hp.iso(value[1]).count
|
||||
disk['entries'] += 1
|
||||
if value[0] < disk['oldest']:
|
||||
disk['oldest'] = value[0]
|
||||
disk['keys'].append((key, GetInHMS(time.time() - value[0])))
|
||||
finally:
|
||||
portalocker.unlock(locker)
|
||||
locker.close()
|
||||
disk_storage.close()
|
||||
|
||||
finally:
|
||||
portalocker.unlock(locker)
|
||||
locker.close()
|
||||
disk_storage.close()
|
||||
|
||||
total['entries'] = ram['entries'] + disk['entries']
|
||||
total['bytes'] = ram['bytes'] + disk['bytes']
|
||||
total['objects'] = ram['objects'] + disk['objects']
|
||||
total['hits'] = ram['hits'] + disk['hits']
|
||||
total['misses'] = ram['misses'] + disk['misses']
|
||||
total['keys'] = ram['keys'] + disk['keys']
|
||||
try:
|
||||
total['ratio'] = total['hits'] * 100 / (total['hits'] +
|
||||
total['entries'] = ram['entries'] + disk['entries']
|
||||
total['bytes'] = ram['bytes'] + disk['bytes']
|
||||
total['objects'] = ram['objects'] + disk['objects']
|
||||
total['hits'] = ram['hits'] + disk['hits']
|
||||
total['misses'] = ram['misses'] + disk['misses']
|
||||
total['keys'] = ram['keys'] + disk['keys']
|
||||
try:
|
||||
total['ratio'] = total['hits'] * 100 / (total['hits'] +
|
||||
total['misses'])
|
||||
except (KeyError, ZeroDivisionError):
|
||||
total['ratio'] = 0
|
||||
except (KeyError, ZeroDivisionError):
|
||||
total['ratio'] = 0
|
||||
|
||||
if disk['oldest'] < ram['oldest']:
|
||||
total['oldest'] = disk['oldest']
|
||||
else:
|
||||
total['oldest'] = ram['oldest']
|
||||
if disk['oldest'] < ram['oldest']:
|
||||
total['oldest'] = disk['oldest']
|
||||
else:
|
||||
total['oldest'] = ram['oldest']
|
||||
|
||||
ram['oldest'] = GetInHMS(time.time() - ram['oldest'])
|
||||
disk['oldest'] = GetInHMS(time.time() - disk['oldest'])
|
||||
total['oldest'] = GetInHMS(time.time() - total['oldest'])
|
||||
ram['oldest'] = GetInHMS(time.time() - ram['oldest'])
|
||||
disk['oldest'] = GetInHMS(time.time() - disk['oldest'])
|
||||
total['oldest'] = GetInHMS(time.time() - total['oldest'])
|
||||
|
||||
def key_table(keys):
|
||||
return TABLE(
|
||||
@@ -502,9 +521,10 @@ def ccache():
|
||||
**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'])
|
||||
if not is_gae:
|
||||
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)
|
||||
|
||||
@@ -20,14 +20,14 @@ jQuery(function(){
|
||||
function hoverMenu(){
|
||||
jQuery('ul.nav a.dropdown-toggle').parent().hover(function(){
|
||||
adjust_height_of_collapsed_nav();
|
||||
mi = jQuery(this).addClass('open');
|
||||
var mi = jQuery(this).addClass('open');
|
||||
mi.children('.dropdown-menu').stop(true, true).delay(200).fadeIn(400);
|
||||
}, function(){
|
||||
mi = jQuery(this);
|
||||
var mi = jQuery(this);
|
||||
mi.children('.dropdown-menu').stop(true, true).delay(200).fadeOut(function(){mi.removeClass('open')});
|
||||
});
|
||||
}
|
||||
hoverMenu(); // first page load
|
||||
jQuery(window).resize(hoverMenu); // on resize event
|
||||
jQuery('ul.nav li.dropdown a').click(function(){window.location=jQuery(this).attr('href');});
|
||||
});
|
||||
});
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -116,13 +116,15 @@
|
||||
|
||||
|
||||
{{elif request.function == 'ccache':}}
|
||||
<h2>{{T("Cache")}}</h2>
|
||||
<div class="list">
|
||||
|
||||
<h2>{{=T("Cache")}}</h2>
|
||||
<div class="list-header">
|
||||
<h3>{{T("Statistics")}}</h3>
|
||||
<h3>{{=T("Statistics")}}</h3>
|
||||
</div>
|
||||
|
||||
{{if request.env.web2py_runtime_gae:}}
|
||||
{{=BEAUTIFY(total)}}
|
||||
{{else:}}
|
||||
<div class="list">
|
||||
<div class="content">
|
||||
<h4>{{=T("Overview")}}</h4>
|
||||
<p>{{=T.M("Number of entries: **%s**", total['entries'])}}</p>
|
||||
@@ -210,6 +212,8 @@
|
||||
{{pass}}
|
||||
</div>
|
||||
|
||||
{{pass}}
|
||||
|
||||
<div class="list-header">
|
||||
<h3>{{=T("Manage Cache")}}</h3>
|
||||
</div>
|
||||
|
||||
@@ -16,6 +16,8 @@ try:
|
||||
except ImportError:
|
||||
pgv = None
|
||||
|
||||
is_gae = request.env.web2py_runtime_gae or False
|
||||
|
||||
# ## critical --- make a copy of the environment
|
||||
|
||||
global_env = copy.copy(globals())
|
||||
@@ -359,36 +361,43 @@ def state():
|
||||
|
||||
|
||||
def ccache():
|
||||
cache.ram.initialize()
|
||||
cache.disk.initialize()
|
||||
if is_gae:
|
||||
form = FORM(
|
||||
P(TAG.BUTTON(T("Clear CACHE?"), _type="submit", _name="yes", _value="yes")))
|
||||
else:
|
||||
cache.ram.initialize()
|
||||
cache.disk.initialize()
|
||||
|
||||
form = FORM(
|
||||
P(TAG.BUTTON(
|
||||
T("Clear CACHE?"), _type="submit", _name="yes", _value="yes")),
|
||||
P(TAG.BUTTON(
|
||||
T("Clear RAM"), _type="submit", _name="ram", _value="ram")),
|
||||
P(TAG.BUTTON(
|
||||
T("Clear DISK"), _type="submit", _name="disk", _value="disk")),
|
||||
)
|
||||
form = FORM(
|
||||
P(TAG.BUTTON(
|
||||
T("Clear CACHE?"), _type="submit", _name="yes", _value="yes")),
|
||||
P(TAG.BUTTON(
|
||||
T("Clear RAM"), _type="submit", _name="ram", _value="ram")),
|
||||
P(TAG.BUTTON(
|
||||
T("Clear DISK"), _type="submit", _name="disk", _value="disk")),
|
||||
)
|
||||
|
||||
if form.accepts(request.vars, session):
|
||||
clear_ram = False
|
||||
clear_disk = False
|
||||
session.flash = ""
|
||||
if request.vars.yes:
|
||||
clear_ram = clear_disk = True
|
||||
if request.vars.ram:
|
||||
clear_ram = True
|
||||
if request.vars.disk:
|
||||
clear_disk = True
|
||||
|
||||
if clear_ram:
|
||||
cache.ram.clear()
|
||||
session.flash += T("Ram Cleared")
|
||||
if clear_disk:
|
||||
cache.disk.clear()
|
||||
session.flash += T("Disk Cleared")
|
||||
|
||||
if is_gae:
|
||||
if request.vars.yes:
|
||||
cache.ram.clear()
|
||||
session.flash += T("Cache Cleared")
|
||||
else:
|
||||
clear_ram = False
|
||||
clear_disk = False
|
||||
if request.vars.yes:
|
||||
clear_ram = clear_disk = True
|
||||
if request.vars.ram:
|
||||
clear_ram = True
|
||||
if request.vars.disk:
|
||||
clear_disk = True
|
||||
if clear_ram:
|
||||
cache.ram.clear()
|
||||
session.flash += T("Ram Cleared")
|
||||
if clear_disk:
|
||||
cache.disk.clear()
|
||||
session.flash += T("Disk Cleared")
|
||||
redirect(URL(r=request))
|
||||
|
||||
try:
|
||||
@@ -414,6 +423,7 @@ def ccache():
|
||||
'oldest': time.time(),
|
||||
'keys': []
|
||||
}
|
||||
|
||||
disk = copy.copy(ram)
|
||||
total = copy.copy(ram)
|
||||
disk['keys'] = []
|
||||
@@ -428,72 +438,81 @@ def ccache():
|
||||
|
||||
return (hours, minutes, seconds)
|
||||
|
||||
for key, value in cache.ram.storage.iteritems():
|
||||
if isinstance(value, dict):
|
||||
ram['hits'] = value['hit_total'] - value['misses']
|
||||
ram['misses'] = value['misses']
|
||||
try:
|
||||
ram['ratio'] = ram['hits'] * 100 / value['hit_total']
|
||||
except (KeyError, ZeroDivisionError):
|
||||
ram['ratio'] = 0
|
||||
else:
|
||||
if hp:
|
||||
ram['bytes'] += hp.iso(value[1]).size
|
||||
ram['objects'] += hp.iso(value[1]).count
|
||||
ram['entries'] += 1
|
||||
if value[0] < ram['oldest']:
|
||||
ram['oldest'] = value[0]
|
||||
ram['keys'].append((key, GetInHMS(time.time() - value[0])))
|
||||
folder = os.path.join(request.folder,'cache')
|
||||
if not os.path.exists(folder):
|
||||
os.mkdir(folder)
|
||||
locker = open(os.path.join(folder, 'cache.lock'), 'a')
|
||||
portalocker.lock(locker, portalocker.LOCK_EX)
|
||||
disk_storage = shelve.open(
|
||||
os.path.join(folder, 'cache.shelve'))
|
||||
try:
|
||||
for key, value in disk_storage.items():
|
||||
if is_gae:
|
||||
gae_stats = cache.ram.client.get_stats()
|
||||
try:
|
||||
gae_stats['ratio'] = ((gae_stats['hits'] * 100) /
|
||||
(gae_stats['hits'] + gae_stats['misses']))
|
||||
except ZeroDivisionError:
|
||||
gae_stats['ratio'] = T("?")
|
||||
gae_stats['oldest'] = GetInHMS(time.time() - gae_stats['oldest_item_age'])
|
||||
total.update(gae_stats)
|
||||
else:
|
||||
for key, value in cache.ram.storage.iteritems():
|
||||
if isinstance(value, dict):
|
||||
disk['hits'] = value['hit_total'] - value['misses']
|
||||
disk['misses'] = value['misses']
|
||||
ram['hits'] = value['hit_total'] - value['misses']
|
||||
ram['misses'] = value['misses']
|
||||
try:
|
||||
disk['ratio'] = disk['hits'] * 100 / value['hit_total']
|
||||
ram['ratio'] = ram['hits'] * 100 / value['hit_total']
|
||||
except (KeyError, ZeroDivisionError):
|
||||
disk['ratio'] = 0
|
||||
ram['ratio'] = 0
|
||||
else:
|
||||
if hp:
|
||||
disk['bytes'] += hp.iso(value[1]).size
|
||||
disk['objects'] += hp.iso(value[1]).count
|
||||
disk['entries'] += 1
|
||||
if value[0] < disk['oldest']:
|
||||
disk['oldest'] = value[0]
|
||||
disk['keys'].append((key, GetInHMS(time.time() - value[0])))
|
||||
ram['bytes'] += hp.iso(value[1]).size
|
||||
ram['objects'] += hp.iso(value[1]).count
|
||||
ram['entries'] += 1
|
||||
if value[0] < ram['oldest']:
|
||||
ram['oldest'] = value[0]
|
||||
ram['keys'].append((key, GetInHMS(time.time() - value[0])))
|
||||
folder = os.path.join(request.folder,'cache')
|
||||
if not os.path.exists(folder):
|
||||
os.mkdir(folder)
|
||||
locker = open(os.path.join(folder, 'cache.lock'), 'a')
|
||||
portalocker.lock(locker, portalocker.LOCK_EX)
|
||||
disk_storage = shelve.open(
|
||||
os.path.join(folder, 'cache.shelve'))
|
||||
try:
|
||||
for key, value in disk_storage.items():
|
||||
if isinstance(value, dict):
|
||||
disk['hits'] = value['hit_total'] - value['misses']
|
||||
disk['misses'] = value['misses']
|
||||
try:
|
||||
disk['ratio'] = disk['hits'] * 100 / value['hit_total']
|
||||
except (KeyError, ZeroDivisionError):
|
||||
disk['ratio'] = 0
|
||||
else:
|
||||
if hp:
|
||||
disk['bytes'] += hp.iso(value[1]).size
|
||||
disk['objects'] += hp.iso(value[1]).count
|
||||
disk['entries'] += 1
|
||||
if value[0] < disk['oldest']:
|
||||
disk['oldest'] = value[0]
|
||||
disk['keys'].append((key, GetInHMS(time.time() - value[0])))
|
||||
finally:
|
||||
portalocker.unlock(locker)
|
||||
locker.close()
|
||||
disk_storage.close()
|
||||
|
||||
finally:
|
||||
portalocker.unlock(locker)
|
||||
locker.close()
|
||||
disk_storage.close()
|
||||
|
||||
total['entries'] = ram['entries'] + disk['entries']
|
||||
total['bytes'] = ram['bytes'] + disk['bytes']
|
||||
total['objects'] = ram['objects'] + disk['objects']
|
||||
total['hits'] = ram['hits'] + disk['hits']
|
||||
total['misses'] = ram['misses'] + disk['misses']
|
||||
total['keys'] = ram['keys'] + disk['keys']
|
||||
try:
|
||||
total['ratio'] = total['hits'] * 100 / (total['hits'] +
|
||||
total['entries'] = ram['entries'] + disk['entries']
|
||||
total['bytes'] = ram['bytes'] + disk['bytes']
|
||||
total['objects'] = ram['objects'] + disk['objects']
|
||||
total['hits'] = ram['hits'] + disk['hits']
|
||||
total['misses'] = ram['misses'] + disk['misses']
|
||||
total['keys'] = ram['keys'] + disk['keys']
|
||||
try:
|
||||
total['ratio'] = total['hits'] * 100 / (total['hits'] +
|
||||
total['misses'])
|
||||
except (KeyError, ZeroDivisionError):
|
||||
total['ratio'] = 0
|
||||
except (KeyError, ZeroDivisionError):
|
||||
total['ratio'] = 0
|
||||
|
||||
if disk['oldest'] < ram['oldest']:
|
||||
total['oldest'] = disk['oldest']
|
||||
else:
|
||||
total['oldest'] = ram['oldest']
|
||||
if disk['oldest'] < ram['oldest']:
|
||||
total['oldest'] = disk['oldest']
|
||||
else:
|
||||
total['oldest'] = ram['oldest']
|
||||
|
||||
ram['oldest'] = GetInHMS(time.time() - ram['oldest'])
|
||||
disk['oldest'] = GetInHMS(time.time() - disk['oldest'])
|
||||
total['oldest'] = GetInHMS(time.time() - total['oldest'])
|
||||
ram['oldest'] = GetInHMS(time.time() - ram['oldest'])
|
||||
disk['oldest'] = GetInHMS(time.time() - disk['oldest'])
|
||||
total['oldest'] = GetInHMS(time.time() - total['oldest'])
|
||||
|
||||
def key_table(keys):
|
||||
return TABLE(
|
||||
@@ -502,9 +521,10 @@ def ccache():
|
||||
**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'])
|
||||
if not is_gae:
|
||||
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)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# coding: utf-8
|
||||
# -*- coding: utf-8 -*-
|
||||
{
|
||||
'!langcode!': 'es',
|
||||
'!langname!': 'Español',
|
||||
@@ -10,6 +10,7 @@
|
||||
'%Y-%m-%d %H:%M:%S': '%d/%m/%Y %H:%M:%S',
|
||||
'(something like "it-it")': '(algo como "eso-eso")',
|
||||
'@markmin\x01An error occured, please [[reload %s]] the page': 'Ha ocurrido un error, por favor [[recargar %s]] la página',
|
||||
'@markmin\x01Number of entries: **%s**': 'Number of entries: **%s**',
|
||||
'A new version of web2py is available': 'Hay una nueva versión de web2py disponible',
|
||||
'A new version of web2py is available: %s': 'Hay una nueva versión de web2py disponible: %s',
|
||||
'About': 'Acerca de',
|
||||
@@ -91,6 +92,7 @@
|
||||
'Database': 'Base de datos',
|
||||
'Database %s select': 'selección en base de datos %s',
|
||||
'database administration': 'administración base de datos',
|
||||
'Database Administration (appadmin)': 'Database Administration (appadmin)',
|
||||
'Date and Time': 'Fecha y Hora',
|
||||
'db': 'bdd',
|
||||
'DB Model': 'Modelo BDD',
|
||||
|
||||
@@ -36,7 +36,7 @@ audio {width:200px}
|
||||
.hidden {display:none;visibility:visible}
|
||||
.right {float:right; text-align:right}
|
||||
.left {float:left; text-align:left}
|
||||
.center {width:100; text-align:center; vertical-align:middle}
|
||||
.center {width:100%; text-align:center; vertical-align:middle}
|
||||
/** end **/
|
||||
|
||||
/* Sticky footer begin */
|
||||
|
||||
@@ -20,14 +20,14 @@ jQuery(function(){
|
||||
function hoverMenu(){
|
||||
jQuery('ul.nav a.dropdown-toggle').parent().hover(function(){
|
||||
adjust_height_of_collapsed_nav();
|
||||
mi = jQuery(this).addClass('open');
|
||||
var mi = jQuery(this).addClass('open');
|
||||
mi.children('.dropdown-menu').stop(true, true).delay(200).fadeIn(400);
|
||||
}, function(){
|
||||
mi = jQuery(this);
|
||||
var mi = jQuery(this);
|
||||
mi.children('.dropdown-menu').stop(true, true).delay(200).fadeOut(function(){mi.removeClass('open')});
|
||||
});
|
||||
}
|
||||
hoverMenu(); // first page load
|
||||
jQuery(window).resize(hoverMenu); // on resize event
|
||||
jQuery('ul.nav li.dropdown a').click(function(){window.location=jQuery(this).attr('href');});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -116,13 +116,15 @@
|
||||
|
||||
|
||||
{{elif request.function == 'ccache':}}
|
||||
<h2>{{T("Cache")}}</h2>
|
||||
<div class="list">
|
||||
|
||||
<h2>{{=T("Cache")}}</h2>
|
||||
<div class="list-header">
|
||||
<h3>{{T("Statistics")}}</h3>
|
||||
<h3>{{=T("Statistics")}}</h3>
|
||||
</div>
|
||||
|
||||
{{if request.env.web2py_runtime_gae:}}
|
||||
{{=BEAUTIFY(total)}}
|
||||
{{else:}}
|
||||
<div class="list">
|
||||
<div class="content">
|
||||
<h4>{{=T("Overview")}}</h4>
|
||||
<p>{{=T.M("Number of entries: **%s**", total['entries'])}}</p>
|
||||
@@ -210,6 +212,8 @@
|
||||
{{pass}}
|
||||
</div>
|
||||
|
||||
{{pass}}
|
||||
|
||||
<div class="list-header">
|
||||
<h3>{{=T("Manage Cache")}}</h3>
|
||||
</div>
|
||||
|
||||
@@ -48,9 +48,11 @@
|
||||
# default_language
|
||||
# The language code (for example: en, it-it) optionally appears in the URL following
|
||||
# the application (which may be omitted). For incoming URLs, the code is copied to
|
||||
# request.language; for outgoing URLs it is taken from request.language.
|
||||
# request.uri_language; for outgoing URLs it is taken from request.uri_language.
|
||||
# If languages=None, language support is disabled.
|
||||
# The default_language, if any, is omitted from the URL.
|
||||
# To use the incoming language in your application, add this line to one of your models files:
|
||||
# if request.uri_language: T.force(request.uri_language)
|
||||
# root_static: list of static files accessed from root (by default, favicon.ico & robots.txt)
|
||||
# (mapped to the default application's static/ directory)
|
||||
# Each default (including domain-mapped) application has its own root-static files.
|
||||
|
||||
+1
-1
@@ -528,7 +528,7 @@ def run_models_in(environment):
|
||||
models_to_run = None
|
||||
for model in models:
|
||||
if response.models_to_run != models_to_run:
|
||||
regex = models_to_run = response.models_to_run
|
||||
regex = models_to_run = response.models_to_run[:]
|
||||
if isinstance(regex, list):
|
||||
regex = re_compile('|'.join(regex))
|
||||
if models_to_run:
|
||||
|
||||
@@ -98,27 +98,32 @@ class RPXAccount(object):
|
||||
def login_form(self):
|
||||
request = self.request
|
||||
args = request.args
|
||||
if self.embed:
|
||||
JANRAIN_URL = \
|
||||
"https://%s.rpxnow.com/openid/embed?token_url=%s&language_preference=%s"
|
||||
rpxform = IFRAME(
|
||||
_src=JANRAIN_URL % (
|
||||
self.domain, self.token_url, self.language),
|
||||
_scrolling="no",
|
||||
_frameborder="no",
|
||||
_style="width:400px;height:240px;")
|
||||
else:
|
||||
JANRAIN_URL = \
|
||||
"https://%s.rpxnow.com/openid/v2/signin?token_url=%s"
|
||||
rpxform = DIV(SCRIPT(_src="https://rpxnow.com/openid/v2/widget",
|
||||
_type="text/javascript"),
|
||||
SCRIPT("RPXNOW.overlay = true;",
|
||||
"RPXNOW.language_preference = '%s';" % self.language,
|
||||
"RPXNOW.realm = '%s';" % self.domain,
|
||||
"RPXNOW.token_url = '%s';" % self.token_url,
|
||||
"RPXNOW.show();",
|
||||
_type="text/javascript"))
|
||||
return rpxform
|
||||
rpxform = """
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
if (typeof window.janrain !== 'object') window.janrain = {};
|
||||
if (typeof window.janrain.settings !== 'object') window.janrain.settings = {};
|
||||
janrain.settings.tokenUrl = '%s';
|
||||
function isReady() { janrain.ready = true; };
|
||||
if (document.addEventListener) {
|
||||
document.addEventListener("DOMContentLoaded", isReady, false);
|
||||
} else {
|
||||
window.attachEvent('onload', isReady);
|
||||
}
|
||||
var e = document.createElement('script');
|
||||
e.type = 'text/javascript';
|
||||
e.id = 'janrainAuthWidget';
|
||||
if (document.location.protocol === 'https:') {
|
||||
e.src = 'https://rpxnow.com/js/lib/%s/engage.js';
|
||||
} else {
|
||||
e.src = 'http://widget-cdn.rpxnow.com/js/lib/%s/engage.js';
|
||||
}
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(e, s);
|
||||
})();
|
||||
</script>
|
||||
<div id="janrainEngageEmbed"></div>""" % (self.token_url, self.domain, self.domain)
|
||||
return XML(rpxform)
|
||||
|
||||
|
||||
def use_janrain(auth, filename='private/janrain.key', **kwargs):
|
||||
|
||||
@@ -266,5 +266,5 @@ def populate_generator(table, default=True, compute=False, contents={}):
|
||||
|
||||
if __name__ == '__main__':
|
||||
ell = Learner()
|
||||
ell.loadd(eval(IUP))
|
||||
ell.loadd(IUP)
|
||||
print ell.generate(1000, prefix=None)
|
||||
|
||||
+5
-2
@@ -8189,8 +8189,8 @@ def index():
|
||||
limits = (offset,long(vars.get('limit',None) or 1000)+offset)
|
||||
except ValueError:
|
||||
return Row({'status':400,'error':'invalid limits','response':None})
|
||||
if count > limits[1]-limits[0]:
|
||||
return Row({'status':400,'error':'too many records','response':None})
|
||||
#if count > limits[1]-limits[0]:
|
||||
# return Row({'status':400,'error':'too many records','response':None})
|
||||
try:
|
||||
response = dbset.select(limitby=limits,orderby=orderby,*fields)
|
||||
except ValueError:
|
||||
@@ -8453,6 +8453,9 @@ def index():
|
||||
columns = adapter.cursor.description
|
||||
# reduce the column info down to just the field names
|
||||
fields = colnames or [f[0] for f in columns]
|
||||
if len(fields) != len(set(fields)):
|
||||
raise RuntimeError("Result set includes duplicate column names. Specify unique column names using the 'colnames' argument")
|
||||
|
||||
# will hold our finished resultset in a list
|
||||
data = adapter._fetchall()
|
||||
# convert the list for each row into a dictionary so it's
|
||||
|
||||
+2
-1
@@ -3204,7 +3204,8 @@ class ExporterHTML(ExportClass):
|
||||
ExportClass.__init__(self, rows)
|
||||
|
||||
def export(self):
|
||||
return '<html>\n<head>\n<meta http-equiv="content-type" content="text/html; charset=UTF-8" />\n</head>\n<body>\n%s\n</body>\n</html>' % (self.rows.xml() or '')
|
||||
xml = self.rows.xml() if self.rows else ''
|
||||
return '<html>\n<head>\n<meta http-equiv="content-type" content="text/html; charset=UTF-8" />\n</head>\n<body>\n%s\n</body>\n</html>' % (xml or '')
|
||||
|
||||
class ExporterXML(ExportClass):
|
||||
label = 'XML'
|
||||
|
||||
+2
-2
@@ -2112,7 +2112,7 @@ class Auth(object):
|
||||
success = False
|
||||
if row:
|
||||
userfield = self.settings.login_userfield or 'username' \
|
||||
if 'username' in table_user.fields else 'email'
|
||||
if 'username' in table.fields else 'email'
|
||||
# If ticket is a service Ticket and RENEW flag respected
|
||||
if ticket[0:3] == 'ST-' and \
|
||||
not ((row.renew and renew) ^ renew):
|
||||
@@ -5893,7 +5893,7 @@ class Wiki(object):
|
||||
class Config(object):
|
||||
def __init__(
|
||||
self,
|
||||
filename,
|
||||
filename,
|
||||
section,
|
||||
default_values={}
|
||||
):
|
||||
|
||||
+1
-1
@@ -458,7 +458,7 @@ class IS_IN_SET(Validator):
|
||||
|
||||
|
||||
regex1 = re.compile('\w+\.\w+')
|
||||
regex2 = re.compile('%\((?P<name>[^\)]+)\)s')
|
||||
regex2 = re.compile('%\((?P<name>[^\)]+)\)(\d*\.\d*)?[a-zA-Z]')
|
||||
|
||||
|
||||
class IS_IN_DB(Validator):
|
||||
|
||||
Reference in New Issue
Block a user