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

This commit is contained in:
Fran Boon committed 2014-01-07 21:26:31 +00:00
commit 8ba8eb58ed
29 files changed
+236 -80

No files matched your search

+1 -1
View File
@@ -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
+24 -4
View File
@@ -16,6 +16,8 @@ try:
except ImportError: except ImportError:
pgv = None pgv = None
is_gae = request.env.web2py_runtime_gae or False
# ## critical --- make a copy of the environment # ## critical --- make a copy of the environment
global_env = copy.copy(globals()) global_env = copy.copy(globals())
@@ -359,6 +361,10 @@ def state():
def ccache(): def ccache():
if is_gae:
form = FORM(
P(TAG.BUTTON(T("Clear CACHE?"), _type="submit", _name="yes", _value="yes")))
else:
cache.ram.initialize() cache.ram.initialize()
cache.disk.initialize() cache.disk.initialize()
@@ -372,23 +378,26 @@ def ccache():
) )
if form.accepts(request.vars, session): if form.accepts(request.vars, session):
session.flash = ""
if is_gae:
if request.vars.yes:
cache.ram.clear()
session.flash += T("Cache Cleared")
else:
clear_ram = False clear_ram = False
clear_disk = False clear_disk = False
session.flash = ""
if request.vars.yes: if request.vars.yes:
clear_ram = clear_disk = True clear_ram = clear_disk = True
if request.vars.ram: if request.vars.ram:
clear_ram = True clear_ram = True
if request.vars.disk: if request.vars.disk:
clear_disk = True clear_disk = True
if clear_ram: if clear_ram:
cache.ram.clear() cache.ram.clear()
session.flash += T("Ram Cleared") session.flash += T("Ram Cleared")
if clear_disk: if clear_disk:
cache.disk.clear() cache.disk.clear()
session.flash += T("Disk Cleared") session.flash += T("Disk Cleared")
redirect(URL(r=request)) redirect(URL(r=request))
try: try:
@@ -414,6 +423,7 @@ def ccache():
'oldest': time.time(), 'oldest': time.time(),
'keys': [] 'keys': []
} }
disk = copy.copy(ram) disk = copy.copy(ram)
total = copy.copy(ram) total = copy.copy(ram)
disk['keys'] = [] disk['keys'] = []
@@ -428,6 +438,16 @@ def ccache():
return (hours, minutes, seconds) return (hours, minutes, seconds)
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(): for key, value in cache.ram.storage.iteritems():
if isinstance(value, dict): if isinstance(value, dict):
ram['hits'] = value['hit_total'] - value['misses'] ram['hits'] = value['hit_total'] - value['misses']
@@ -468,7 +488,6 @@ def ccache():
if value[0] < disk['oldest']: if value[0] < disk['oldest']:
disk['oldest'] = value[0] disk['oldest'] = value[0]
disk['keys'].append((key, GetInHMS(time.time() - value[0]))) disk['keys'].append((key, GetInHMS(time.time() - value[0])))
finally: finally:
portalocker.unlock(locker) portalocker.unlock(locker)
locker.close() locker.close()
@@ -502,6 +521,7 @@ def ccache():
**dict(_class='cache-keys', **dict(_class='cache-keys',
_style="border-collapse: separate; border-spacing: .5em;")) _style="border-collapse: separate; border-spacing: .5em;"))
if not is_gae:
ram['keys'] = key_table(ram['keys']) ram['keys'] = key_table(ram['keys'])
disk['keys'] = key_table(disk['keys']) disk['keys'] = key_table(disk['keys'])
total['keys'] = key_table(total['keys']) total['keys'] = key_table(total['keys'])
+20 -4
View File
@@ -574,10 +574,10 @@ def edit():
# Load json only if it is ajax edited... # Load json only if it is ajax edited...
app = get_app(request.vars.app) app = get_app(request.vars.app)
app_path = apath(app, r=request) 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'), config = Config(os.path.join(request.folder, 'settings.cfg'),
section='editor', default_values=editor_defaults) section='editor', default_values={})
preferences = config.read() preferences.update(config.read())
if not(request.ajax) and not(is_mobile): if not(request.ajax) and not(is_mobile):
# return the scaffolding, the rest will be through ajax requests # return the scaffolding, the rest will be through ajax requests
@@ -589,7 +589,7 @@ def edit():
if request.post_vars: #save new preferences if request.post_vars: #save new preferences
post_vars = request.post_vars.items() 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 # 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): if config.save(post_vars):
response.headers["web2py-component-flash"] = T('Preferences saved correctly') response.headers["web2py-component-flash"] = T('Preferences saved correctly')
else: else:
@@ -814,6 +814,22 @@ def todolist():
return {'todo':output, 'app': app} 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(): def resolve():
""" """
""" """
+13
View File
@@ -12,6 +12,7 @@
'(version %s)': '(version %s)', '(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\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\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', '@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': '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', 'A new version of web2py is available: %s': 'Hay una nueva versión de web2py disponible: %s',
@@ -57,11 +58,13 @@
'Autocomplete': 'Autocomplete', 'Autocomplete': 'Autocomplete',
'Autocomplete Python Code': 'Autocompletar código Python', 'Autocomplete Python Code': 'Autocompletar código Python',
'Available databases and tables': 'Bases de datos y tablas disponibles', 'Available databases and tables': 'Bases de datos y tablas disponibles',
'Available Databases and Tables': 'Available Databases and Tables',
'back': 'atrás', 'back': 'atrás',
'Back to the plugins list': 'Back to the plugins list', 'Back to the plugins list': 'Back to the plugins list',
'breakpoint': 'breakpoint', 'breakpoint': 'breakpoint',
'breakpoints': 'breakpoints', 'breakpoints': 'breakpoints',
'browse': 'buscar', 'browse': 'buscar',
'Cache': 'Cache',
'cache': 'cache', 'cache': 'cache',
'cache, errors and sessions cleaned': 'cache, errores y sesiones eliminados', 'cache, errors and sessions cleaned': 'cache, errores y sesiones eliminados',
'can be a git repo': 'puede ser un repositorio git', 'can be a git repo': 'puede ser un repositorio git',
@@ -79,6 +82,9 @@
'Check to delete': 'Marque para eliminar', 'Check to delete': 'Marque para eliminar',
'Checking for upgrades...': 'Buscando actulizaciones...', 'Checking for upgrades...': 'Buscando actulizaciones...',
'Clean': 'limpiar', '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 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 here for the administrative interface': 'haga clic aquí para usar la interfaz administrativa',
'Click row to expand traceback': 'Click row to expand traceback', 'Click row to expand traceback': 'Click row to expand traceback',
@@ -113,6 +119,7 @@
'database': 'base de datos', 'database': 'base de datos',
'database %s select': 'selección en base de datos %s', 'database %s select': 'selección en base de datos %s',
'database administration': 'administración base de datos', 'database administration': 'administración base de datos',
'Database Administration (appadmin)': 'Database Administration (appadmin)',
'Date and Time': 'Fecha y Hora', 'Date and Time': 'Fecha y Hora',
'db': 'db', 'db': 'db',
'Debug': 'Debug', 'Debug': 'Debug',
@@ -135,6 +142,7 @@
'details': 'detalles', 'details': 'detalles',
'direction: ltr': 'direction: ltr', 'direction: ltr': 'direction: ltr',
'Disable': 'Deshabilitar', 'Disable': 'Deshabilitar',
'DISK': 'DISK',
'docs': 'docs', 'docs': 'docs',
'Docs': 'Docs', 'Docs': 'Docs',
'Done!': 'Done!', 'Done!': 'Done!',
@@ -249,6 +257,7 @@
'Lost Password': 'Contraseña perdida', 'Lost Password': 'Contraseña perdida',
'manage': 'gestionar', 'manage': 'gestionar',
'Manage': 'Gestionar', 'Manage': 'Gestionar',
'Manage Cache': 'Manage Cache',
'merge': 'combinar', 'merge': 'combinar',
'Models': 'Modelos', 'Models': 'Modelos',
'models': 'modelos', 'models': 'modelos',
@@ -282,6 +291,7 @@
'or provide application url:': 'o provea URL de la aplicación:', 'or provide application url:': 'o provea URL de la aplicación:',
'Origin': 'Origen', 'Origin': 'Origen',
'Original/Translation': 'Original/Traducción', 'Original/Translation': 'Original/Traducción',
'Overview': 'Overview',
'Overwrite installed app': 'sobreescriba la aplicación instalada', 'Overwrite installed app': 'sobreescriba la aplicación instalada',
'Pack all': 'empaquetar todo', 'Pack all': 'empaquetar todo',
'Pack compiled': 'empaquete compiladas', 'Pack compiled': 'empaquete compiladas',
@@ -305,6 +315,7 @@
'private files': 'archivos privados', 'private files': 'archivos privados',
'Project Progress': 'Project Progress', 'Project Progress': 'Project Progress',
'Query:': 'Consulta:', 'Query:': 'Consulta:',
'RAM': 'RAM',
'Rapid Search': 'Rapid Search', 'Rapid Search': 'Rapid Search',
'record': 'registro', 'record': 'registro',
'record does not exist': 'el registro no existe', 'record does not exist': 'el registro no existe',
@@ -356,6 +367,7 @@
'Static': 'Static', 'Static': 'Static',
'static': 'estáticos', 'static': 'estáticos',
'Static files': 'Archivos estáticos', 'Static files': 'Archivos estáticos',
'Statistics': 'Statistics',
'step': 'step', 'step': 'step',
'stop': 'stop', 'stop': 'stop',
'submit': 'enviar', 'submit': 'enviar',
@@ -397,6 +409,7 @@
'To emulate a breakpoint programatically, write:': 'To emulate a breakpoint programatically, write:', 'To emulate a breakpoint programatically, write:': 'To emulate a breakpoint programatically, write:',
'to use the debugger!': 'to use the debugger!', 'to use the debugger!': 'to use the debugger!',
'toggle breakpoint': 'alternar punto de ruptura', 'toggle breakpoint': 'alternar punto de ruptura',
'Toggle comment': 'Toggle comment',
'Toggle Fullscreen': 'Alternar pantalla completa', 'Toggle Fullscreen': 'Alternar pantalla completa',
'Traceback': 'Traceback', 'Traceback': 'Traceback',
'translation strings for the application': 'cadenas de caracteres de traducción para la aplicación', 'translation strings for the application': 'cadenas de caracteres de traducción para la aplicación',
+2 -1
View File
@@ -1,4 +1,4 @@
# coding: utf8 # -*- coding: utf-8 -*-
{ {
'!langcode!': 'it', '!langcode!': 'it',
'!langname!': 'Italiano', '!langname!': 'Italiano',
@@ -303,6 +303,7 @@
'to previous version.': 'torna a versione precedente', '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]', '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 breakpoint': 'toggle breakpoint',
'Toggle comment': 'Toggle comment',
'Toggle Fullscreen': 'Toggle Fullscreen', 'Toggle Fullscreen': 'Toggle Fullscreen',
'Traceback': 'Traceback', 'Traceback': 'Traceback',
'translation strings for the application': "stringhe di traduzioni per l'applicazione", 'translation strings for the application': "stringhe di traduzioni per l'applicazione",
+1 -1
View File
@@ -45,4 +45,4 @@ if 'adminLanguage' in request.cookies and not (request.cookies['adminLanguage']
T.force(request.cookies['adminLanguage'].value) T.force(request.cookies['adminLanguage'].value)
#set static_version #set static_version
response.static_version = '2.7.3' response.static_version = open('VERSION').read().split(' ',1)[1].split('-')[0]
+3 -3
View File
@@ -1,10 +1,10 @@
[DEFAULT] [DEFAULT]
theme = web2py
closetag = true
editor = default
[editor] [editor]
theme = web2py theme = web2py
editor = default editor = default
closetag = true closetag = true
[editor_sessions]
welcome = welcome/models/db.py,welcome/controllers/default.py,welcome/views/default/index.html
+1 -1
View File
@@ -260,7 +260,7 @@ function load_file(url, lineno) {
if(typeof (json['plain_html']) !== undefined) { if(typeof (json['plain_html']) !== undefined) {
if($('#' + json['id']).length === 0 || json['force'] === true) { if($('#' + json['id']).length === 0 || json['force'] === true) {
// Create a tab and put the code in it // 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">&times;</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">&times;</button>' + json['realfilename'] + '</a></li>';
var tab_body = '<div id="' + json['id'] + '" class="tab-pane fade in " >' + json['plain_html'] + '</div>'; var tab_body = '<div id="' + json['id'] + '" class="tab-pane fade in " >' + json['plain_html'] + '</div>';
if(json['force'] === false) { if(json['force'] === false) {
$('#myTabContent').append($(tab_body)); // First load the body $('#myTabContent').append($(tab_body)); // First load the body
@@ -20,10 +20,10 @@ jQuery(function(){
function hoverMenu(){ function hoverMenu(){
jQuery('ul.nav a.dropdown-toggle').parent().hover(function(){ jQuery('ul.nav a.dropdown-toggle').parent().hover(function(){
adjust_height_of_collapsed_nav(); 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); mi.children('.dropdown-menu').stop(true, true).delay(200).fadeIn(400);
}, function(){ }, function(){
mi = jQuery(this); var mi = jQuery(this);
mi.children('.dropdown-menu').stop(true, true).delay(200).fadeOut(function(){mi.removeClass('open')}); mi.children('.dropdown-menu').stop(true, true).delay(200).fadeOut(function(){mi.removeClass('open')});
}); });
} }
+8 -4
View File
@@ -116,13 +116,15 @@
{{elif request.function == 'ccache':}} {{elif request.function == 'ccache':}}
<h2>{{T("Cache")}}</h2> <h2>{{=T("Cache")}}</h2>
<div class="list">
<div class="list-header"> <div class="list-header">
<h3>{{T("Statistics")}}</h3> <h3>{{=T("Statistics")}}</h3>
</div> </div>
{{if request.env.web2py_runtime_gae:}}
{{=BEAUTIFY(total)}}
{{else:}}
<div class="list">
<div class="content"> <div class="content">
<h4>{{=T("Overview")}}</h4> <h4>{{=T("Overview")}}</h4>
<p>{{=T.M("Number of entries: **%s**", total['entries'])}}</p> <p>{{=T.M("Number of entries: **%s**", total['entries'])}}</p>
@@ -210,6 +212,8 @@
{{pass}} {{pass}}
</div> </div>
{{pass}}
<div class="list-header"> <div class="list-header">
<h3>{{=T("Manage Cache")}}</h3> <h3>{{=T("Manage Cache")}}</h3>
</div> </div>
@@ -208,6 +208,9 @@ $(document).on('click', 'a.font_button', function (e) {
<div class='row-fluid'> <div class='row-fluid'>
<div class="right controls btn-toolbar pull-right"> <div class="right controls btn-toolbar pull-right">
{{=LOAD('default', 'editor_sessions', ajax=True, _class='btn-group')}}
<div class="btn-group"> <div class="btn-group">
<a class="button btn" onclick="$('#files').toggle(); return false" href="#">Files toggle</a> <a class="button btn" onclick="$('#files').toggle(); return false" href="#">Files toggle</a>
</div> </div>
@@ -314,5 +317,28 @@ $(document).ready(function() {
load_file(datum.link); load_file(datum.link);
$(this).val(''); $(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> </script>
<!-- end "edit" block --> <!-- 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>
+24 -4
View File
@@ -16,6 +16,8 @@ try:
except ImportError: except ImportError:
pgv = None pgv = None
is_gae = request.env.web2py_runtime_gae or False
# ## critical --- make a copy of the environment # ## critical --- make a copy of the environment
global_env = copy.copy(globals()) global_env = copy.copy(globals())
@@ -359,6 +361,10 @@ def state():
def ccache(): def ccache():
if is_gae:
form = FORM(
P(TAG.BUTTON(T("Clear CACHE?"), _type="submit", _name="yes", _value="yes")))
else:
cache.ram.initialize() cache.ram.initialize()
cache.disk.initialize() cache.disk.initialize()
@@ -372,23 +378,26 @@ def ccache():
) )
if form.accepts(request.vars, session): if form.accepts(request.vars, session):
session.flash = ""
if is_gae:
if request.vars.yes:
cache.ram.clear()
session.flash += T("Cache Cleared")
else:
clear_ram = False clear_ram = False
clear_disk = False clear_disk = False
session.flash = ""
if request.vars.yes: if request.vars.yes:
clear_ram = clear_disk = True clear_ram = clear_disk = True
if request.vars.ram: if request.vars.ram:
clear_ram = True clear_ram = True
if request.vars.disk: if request.vars.disk:
clear_disk = True clear_disk = True
if clear_ram: if clear_ram:
cache.ram.clear() cache.ram.clear()
session.flash += T("Ram Cleared") session.flash += T("Ram Cleared")
if clear_disk: if clear_disk:
cache.disk.clear() cache.disk.clear()
session.flash += T("Disk Cleared") session.flash += T("Disk Cleared")
redirect(URL(r=request)) redirect(URL(r=request))
try: try:
@@ -414,6 +423,7 @@ def ccache():
'oldest': time.time(), 'oldest': time.time(),
'keys': [] 'keys': []
} }
disk = copy.copy(ram) disk = copy.copy(ram)
total = copy.copy(ram) total = copy.copy(ram)
disk['keys'] = [] disk['keys'] = []
@@ -428,6 +438,16 @@ def ccache():
return (hours, minutes, seconds) return (hours, minutes, seconds)
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(): for key, value in cache.ram.storage.iteritems():
if isinstance(value, dict): if isinstance(value, dict):
ram['hits'] = value['hit_total'] - value['misses'] ram['hits'] = value['hit_total'] - value['misses']
@@ -468,7 +488,6 @@ def ccache():
if value[0] < disk['oldest']: if value[0] < disk['oldest']:
disk['oldest'] = value[0] disk['oldest'] = value[0]
disk['keys'].append((key, GetInHMS(time.time() - value[0]))) disk['keys'].append((key, GetInHMS(time.time() - value[0])))
finally: finally:
portalocker.unlock(locker) portalocker.unlock(locker)
locker.close() locker.close()
@@ -502,6 +521,7 @@ def ccache():
**dict(_class='cache-keys', **dict(_class='cache-keys',
_style="border-collapse: separate; border-spacing: .5em;")) _style="border-collapse: separate; border-spacing: .5em;"))
if not is_gae:
ram['keys'] = key_table(ram['keys']) ram['keys'] = key_table(ram['keys'])
disk['keys'] = key_table(disk['keys']) disk['keys'] = key_table(disk['keys'])
total['keys'] = key_table(total['keys']) total['keys'] = key_table(total['keys'])
@@ -20,10 +20,10 @@ jQuery(function(){
function hoverMenu(){ function hoverMenu(){
jQuery('ul.nav a.dropdown-toggle').parent().hover(function(){ jQuery('ul.nav a.dropdown-toggle').parent().hover(function(){
adjust_height_of_collapsed_nav(); 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); mi.children('.dropdown-menu').stop(true, true).delay(200).fadeIn(400);
}, function(){ }, function(){
mi = jQuery(this); var mi = jQuery(this);
mi.children('.dropdown-menu').stop(true, true).delay(200).fadeOut(function(){mi.removeClass('open')}); mi.children('.dropdown-menu').stop(true, true).delay(200).fadeOut(function(){mi.removeClass('open')});
}); });
} }
+12 -8
View File
@@ -25,14 +25,9 @@ print markmin2html(m)
from markmin2latex import markmin2latex from markmin2latex import markmin2latex
print markmin2latex(m) print markmin2latex(m)
from markmin2pdf import markmin2pdf # requires pdflatex from markmin2pdf import markmin2pdf # requires pdflatex
print markmin2pdf(m)</code></pre> ====================<h1>This is a test block with new features:</h1><p>This is a blockquote with a list with tables in it:</p><blockquote class="blockquoteclass" id="markmin_blockquoteid">This is a paragraph before list. You can continue paragraph on the next lines.<br />This is an ordered list with tables:<ol><li>Item 1</li><li>Item 2</li><li><table class="tableclass1" id="markmin_tableid1"><tbody><tr class="first"><td>aa</td><td>bb</td><td>cc</td></tr><tr class="even"><td class="num">11</td><td class="num">22</td><td class="num">33</td></tr></tbody></table></li><li>Item 4 <table class="tableclass1"><thead><tr class="first"><td>T1</td><td>T2</td><td>t3</td></tr></thead><tbody><tr class="first"><td>aaa</td><td>bbb</td><td>ccc</td></tr><tr class="even"><td>ddd</td><td>fff</td><td>ggg</td></tr><tr><td class="num">123</td><td class="num">0</td><td class="num">5.0</td></tr></tbody></table></li></ol></blockquote><p>This this a new paragraph with a table. Table has header, footer, sections, odd and even rows:</p><table class="tableclass1" id="markmin_tableid2"><thead><tr class="first"><td><strong>Title 1</strong></td><td><strong>Title 2</strong></td><td><strong>Title 3</strong></td></tr></thead><tbody><tr class="first"><td>data 1</td><td>data 2</td><td class="num">2.00</td></tr><tr class="even"><td>data 3</td><td>data4(long)</td><td class="num">23.00</td></tr><tr><td></td><td>data 5</td><td class="num">33.50</td></tr><tr class="first"><td>New section</td><td>New data</td><td class="num">5.00</td></tr><tr class="even"><td>data 1</td><td>data2(long)</td><td class="num">100.45</td></tr><tr><td></td><td>data 3</td><td class="num">12.50</td></tr><tr class="even"><td>data 4</td><td>data 5</td><td class="num">.33</td></tr><tr><td>data 6</td><td>data7(long)</td><td class="num">8.01</td></tr><tr class="even"><td></td><td>data 8</td><td class="num">514</td></tr></tbody><tfoot><tr class="first"><td>Total:</td><td>9 items</td><td>698,79</td></tr></tfoot></table><h2>Multilevel lists</h2><p>Now lists can be multilevel:</p><ol><li>Ordered item 1 on level 1. You can continue item text on next strings<ol><li><p>Ordered item 1 of sublevel 2 with a paragraph (paragraph can start with point after plus or minus characters, e.g. <strong>++.</strong> or <strong>--.</strong>)</p><li><p>This is another item. But with 3 paragraphs, blockquote and sublists:</p><p>This is the second paragraph in the item. You can add paragraphs to an item, using point notation, where first characters in the string are sequence of points with space between them and another string. For example, this paragraph (in sublevel 2) starts with two points:</p><code>.. This is the second paragraph...</code><blockquote><h3>this is a blockquote in a list</h3>You can use blockquote with headers, paragraphs, tables and lists in it:<br />Tables can have or have not header and footer. This table is defined without any header and footer in it:<table><tbody><tr class="first"><td>red</td><td>fox</td><td class="num">0</td></tr><tr class="even"><td>blue</td><td>dolphin</td><td class="num">1000</td></tr><tr><td>green</td><td>leaf</td><td class="num">10000</td></tr></tbody></table></blockquote><p>This is yet another paragraph in the item.</p><ul><li>This is an item of unordered list <strong>(sublevel 3)</strong></li><li>This is the second item of the unordered list <em>(sublevel 3)</em><ol><ol><ol><li>This is a single item of ordered list in sublevel 6</li></ol></ol><p>and this is a paragraph in sublevel 4</p></ol></li><li><p>This is a new item with paragraph in sublevel 3.</p><ol><li>Start ordered list in sublevel 4 with code block: <pre><code>line 1 print markmin2pdf(m)</code></pre>
line 2
line 3</code></pre></li><li><p>Yet another item with code block:</p><pre><code> line 1 <h2>Why?</h2><p>We wanted a markup language with the following requirements:</p><ul><li>less than 300 lines of functional code</li><li>easy to read</li><li>secure</li><li>support table, ul, ol, code</li><li>support html5 video and audio elements (html serialization only)</li><li>can align images and resize them</li><li>can specify class for tables and code elements</li><li>can add anchors</li><li>does not use _ for markup (since it creates odd behavior)</li><li>automatically links urls</li><li>fast</li><li>easy to extend</li><li>supports latex and pdf including references</li><li>allows to describe the markup in the markup (this document is generated from markmin syntax)</li></ul><p>(results depend on text but in average for text ~100K markmin is 30% faster than markdown, for text ~10K it is 10x faster)</p><p>The <a href="http://www.lulu.com/shop/massimo-di-pierro/web2py-5th-edition/paperback/product-20745116.html">web2py book</a> published by lulu, for example, was entirely generated with markmin2pdf from the online <a href="http://www.web2py.com/book">web2py wiki</a></p><h2>Download</h2><ul><li><a href="http://web2py.googlecode.com/hg/gluon/contrib/markmin/markmin2html.py">http://web2py.googlecode.com/hg/gluon/contrib/markmin/markmin2html.py</a></li><li><a href="http://web2py.googlecode.com/hg/gluon/contrib/markmin/markmin2latex.py">http://web2py.googlecode.com/hg/gluon/contrib/markmin/markmin2latex.py</a></li><li><a href="http://web2py.googlecode.com/hg/gluon/contrib/markmin/markmin2pdf.py">http://web2py.googlecode.com/hg/gluon/contrib/markmin/markmin2pdf.py</a></li></ul><p>markmin2html.py and markmin2latex.py are single files and have no web2py dependence. Their license is BSD.</p><h2>Examples</h2><h3>Bold, italic, code and links</h3><table><thead><tr class="first"><td><strong>SOURCE</strong></td><td><strong>OUTPUT</strong></td></tr></thead><tbody><tr class="first"><td><code># title</code></td><td><strong>title</strong></td></tr><tr class="even"><td><code>## section</code></td><td><strong>section</strong></td></tr><tr><td><code>### subsection</code></td><td><strong>subsection</strong></td></tr><tr class="even"><td><code>**bold**</code></td><td><strong>bold</strong></td></tr><tr><td><code>''italic''</code></td><td><em>italic</em></td></tr><tr class="even"><td><code>~~strikeout~~</code></td><td><del>strikeout</del></td></tr><tr><td><code>``verbatim``</code></td><td><code>verbatim</code></td></tr><tr class="even"><td><code>``color with **bold**``:red</code></td><td><span style="color: red">color with <strong>bold</strong></span></td></tr><tr><td><code>``many colors``:color[blue:#ffff00]</code></td><td><span style="color: blue;background-color: #ffff00;">many colors</span></td></tr><tr class="even"><td><code>http://google.com</code></td><td><a href="http://google.com">http://google.com</a></td></tr><tr><td><code>[[**click** me #myanchor]]</code></td><td><a href="#markmin_myanchor"><strong>click</strong> me</a></td></tr><tr class="even"><td><code>[[click me [extra info] #myanchor popup]]</code></td><td><a href="#markmin_myanchor" title="extra info" target="_blank">click me</a></td></tr></tbody></table><h3>More on links</h3><p>The format is always <code>[[title link]]</code> or <code>[[title [extra] link]]</code>. Notice you can nest bold, italic, strikeout and code inside the link <code>title</code>.</p><h3>Anchors <a name="markmin_myanchor"></a></h3><p>You can place an anchor anywhere in the text using the syntax <code>[[name]]</code> where <em>name</em> is the name of the anchor. You can then link the anchor with <a href="#markmin_myanchor">link</a>, i.e. <code>[[link #myanchor]]</code> or <a href="#markmin_myanchor" title="extra info">link with an extra info</a>, i.e. <code>[[link with an extra info [extra info] #myanchor]]</code>.</p><h3>Images</h3><p><img src="http://www.web2py.com/examples/static/web2py_logo.png" alt="alt-string for the image" title="the image title" style="float:right" width="200px" /> This paragraph has an image aligned to the right with a width of 200px. Its is placed using the code</p><p><code>[[alt-string for the image [the image title] http://www.web2py.com/examples/static/web2py_logo.png right 200px]]</code>.</p><h3>Unordered Lists</h3><pre><code>- Dog
line 2
line 3</code></pre> This item finishes with this paragraph.</li></ol><p>Item in sublevel 3 can be continued with paragraphs.</p><pre><code> this is another
code block
in the
sublevel 3 item</code></pre></li></ul><ol><li>The last item in sublevel 3</li></ol><p>This is a continuous paragraph for item 2 in sublevel 2. You can use such structure to create difficult structured documents.</p><li>item 3 in sublevel 2</li></li></li></ol><ul><li>item 1 in sublevel 2 (new unordered list)</li><li>item 2 in sublevel 2</li><li>item 3 in sublevel 2</li></ul><ol><li>item 1 in sublevel 2 (new ordered list)</li><li>item 2 in sublevel 2</li><li>item 3 in sublevle 2</li></ol></li><li>item 2 in level 1</li><li>item 3 in level 1</li></ol><ul><li>new unordered list (item 1 in level 1)</li><li>level 2 in level 1</li><li>level 3 in level 1</li><li>level 4 in level 1</li></ul><h2>This is the last section of the test</h2><p>Single paragraph with '----' in it will be turned into separator:</p><hr /><p>And this is the last paragraph in the test. Be happy!</p><p>====================</p><h2>Why?</h2><p>We wanted a markup language with the following requirements:</p><ul><li>less than 300 lines of functional code</li><li>easy to read</li><li>secure</li><li>support table, ul, ol, code</li><li>support html5 video and audio elements (html serialization only)</li><li>can align images and resize them</li><li>can specify class for tables and code elements</li><li>can add anchors</li><li>does not use _ for markup (since it creates odd behavior)</li><li>automatically links urls</li><li>fast</li><li>easy to extend</li><li>supports latex and pdf including references</li><li>allows to describe the markup in the markup (this document is generated from markmin syntax)</li></ul><p>(results depend on text but in average for text ~100K markmin is 30% faster than markdown, for text ~10K it is 10x faster)</p><p>The <a href="http://www.lulu.com/shop/massimo-di-pierro/web2py-5th-edition/paperback/product-20745116.html">web2py book</a> published by lulu, for example, was entirely generated with markmin2pdf from the online <a href="http://www.web2py.com/book">web2py wiki</a></p><h2>Download</h2><ul><li><a href="http://web2py.googlecode.com/hg/gluon/contrib/markmin/markmin2html.py">http://web2py.googlecode.com/hg/gluon/contrib/markmin/markmin2html.py</a></li><li><a href="http://web2py.googlecode.com/hg/gluon/contrib/markmin/markmin2latex.py">http://web2py.googlecode.com/hg/gluon/contrib/markmin/markmin2latex.py</a></li><li><a href="http://web2py.googlecode.com/hg/gluon/contrib/markmin/markmin2pdf.py">http://web2py.googlecode.com/hg/gluon/contrib/markmin/markmin2pdf.py</a></li></ul><p>markmin2html.py and markmin2latex.py are single files and have no web2py dependence. Their license is BSD.</p><h2>Examples</h2><h3>Bold, italic, code and links</h3><table><thead><tr class="first"><td><strong>SOURCE</strong></td><td><strong>OUTPUT</strong></td></tr></thead><tbody><tr class="first"><td><code># title</code></td><td><strong>title</strong></td></tr><tr class="even"><td><code>## section</code></td><td><strong>section</strong></td></tr><tr><td><code>### subsection</code></td><td><strong>subsection</strong></td></tr><tr class="even"><td><code>**bold**</code></td><td><strong>bold</strong></td></tr><tr><td><code>''italic''</code></td><td><em>italic</em></td></tr><tr class="even"><td><code>~~strikeout~~</code></td><td><del>strikeout</del></td></tr><tr><td><code>``verbatim``</code></td><td><code>verbatim</code></td></tr><tr class="even"><td><code>``color with **bold**``:red</code></td><td><span style="color: red">color with <strong>bold</strong></span></td></tr><tr><td><code>``many colors``:color[blue:#ffff00]</code></td><td><span style="color: blue;background-color: #ffff00;">many colors</span></td></tr><tr class="even"><td><code>http://google.com</code></td><td><a href="http://google.com">http://google.com</a></td></tr><tr><td><code>[[**click** me #myanchor]]</code></td><td><a href="#markmin_myanchor"><strong>click</strong> me</a></td></tr><tr class="even"><td><code>[[click me [extra info] #myanchor popup]]</code></td><td><a href="#markmin_myanchor" title="extra info" target="_blank">click me</a></td></tr></tbody></table><h3>More on links</h3><p>The format is always <code>[[title link]]</code> or <code>[[title [extra] link]]</code>. Notice you can nest bold, italic, strikeout and code inside the link <code>title</code>.</p><h3>Anchors <a name="markmin_myanchor"></a></h3><p>You can place an anchor anywhere in the text using the syntax <code>[[name]]</code> where <em>name</em> is the name of the anchor. You can then link the anchor with <a href="#markmin_myanchor">link</a>, i.e. <code>[[link #myanchor]]</code> or <a href="#markmin_myanchor" title="extra info">link with an extra info</a>, i.e. <code>[[link with an extra info [extra info] #myanchor]]</code>.</p><h3>Images</h3><p><img src="http://www.web2py.com/examples/static/web2py_logo.png" alt="alt-string for the image" title="the image title" style="float:right" width="200px" /> This paragraph has an image aligned to the right with a width of 200px. Its is placed using the code</p><p><code>[[Line truncated
- Cat - Cat
- Mouse</code></pre><p>is rendered as</p><ul><li>Dog</li><li>Cat</li><li>Mouse</li></ul><p>Two new lines between items break the list in two lists.</p><h3>Ordered Lists</h3><pre><code>+ Dog - Mouse</code></pre><p>is rendered as</p><ul><li>Dog</li><li>Cat</li><li>Mouse</li></ul><p>Two new lines between items break the list in two lists.</p><h3>Ordered Lists</h3><pre><code>+ Dog
+ Cat + Cat
@@ -85,6 +80,15 @@ markmin2html(text,{'latex':lambda code: LATEX % code.replace('"','\"')})</code><
&lt;html&gt;&lt;body&gt;example&lt;/body&gt;&lt;/html&gt; &lt;html&gt;&lt;body&gt;example&lt;/body&gt;&lt;/html&gt;
``:code[html]</code></pre><h3>Citations and References</h3><p>Citations are treated as internal links in html and proper citations in latex if there is a final section called "References". Items like</p><pre><code>- [[key]] value</code></pre><p>in the References will be translated into Latex</p><pre><code>\bibitem{key} value</code></pre><p>Here is an example of usage:</p><pre><code>As shown in Ref.``mdipierro``:cite ``:code[html]</code></pre><h3>Citations and References</h3><p>Citations are treated as internal links in html and proper citations in latex if there is a final section called "References". Items like</p><pre><code>- [[key]] value</code></pre><p>in the References will be translated into Latex</p><pre><code>\bibitem{key} value</code></pre><p>Here is an example of usage:</p><pre><code>As shown in Ref.``mdipierro``:cite
<h1>This is a test block with new features:</h1><p>This is a blockquote with a list with tables in it:</p><blockquote class="blockquoteclass" id="markmin_blockquoteid">This is a paragraph before list. You can continue paragraph on the next lines.<br />This is an ordered list with tables:<ol><li>Item 1</li><li>Item 2</li><li><table class="tableclass1" id="markmin_tableid1"><tbody><tr class="first"><td>aa</td><td>bb</td><td>cc</td></tr><tr class="even"><td class="num">11</td><td class="num">22</td><td class="num">33</td></tr></tbody></table></li><li>Item 4 <table class="tableclass1"><thead><tr class="first"><td>T1</td><td>T2</td><td>t3</td></tr></thead><tbody><tr class="first"><td>aaa</td><td>bbb</td><td>ccc</td></tr><tr class="even"><td>ddd</td><td>fff</td><td>ggg</td></tr><tr><td class="num">123</td><td class="num">0</td><td class="num">5.0</td></tr></tbody></table></li></ol></blockquote><p>This this a new paragraph with a table. Table has header, footer, sections, odd and even rows:</p><table class="tableclass1" id="markmin_tableid2"><thead><tr class="first"><td><strong>Title 1</strong></td><td><strong>Title 2</strong></td><td><strong>Title 3</strong></td></tr></thead><tbody><tr class="first"><td>data 1</td><td>data 2</td><td class="num">2.00</td></tr><tr class="even"><td>data 3</td><td>data4(long)</td><td class="num">23.00</td></tr><tr><td></td><td>data 5</td><td class="num">33.50</td></tr><tr class="first"><td>New section</td><td>New data</td><td class="num">5.00</td></tr><tr class="even"><td>data 1</td><td>data2(long)</td><td class="num">100.45</td></tr><tr><td></td><td>data 3</td><td class="num">12.50</td></tr><tr class="even"><td>data 4</td><td>data 5</td><td class="num">.33</td></tr><tr><td>data 6</td><td>data7(long)</td><td class="num">8.01</td></tr><tr class="even"><td></td><td>data 8</td><td class="num">514</td></tr></tbody><tfoot><tr class="first"><td>Total:</td><td>9 items</td><td>698,79</td></tr></tfoot></table><h2>Multilevel lists</h2><p>Now lists can be multilevel:</p><ol><li>Ordered item 1 on level 1. You can continue item text on next strings<ol><li><p>Ordered item 1 of sublevel 2 with a paragraph (paragraph can start with point after plus or minus characters, e.g. <strong>++.</strong> or <strong>--.</strong>)</p><li><p>This is another item. But with 3 paragraphs, blockquote and sublists:</p><p>This is the second paragraph in the item. You can add paragraphs to an item, using point notation, where first characters in the string are sequence of points with space between them and another string. For example, this paragraph (in sublevel 2) starts with two points:</p><code>.. This is the second paragraph...</code><blockquote><h3>this is a blockquote in a list</h3>You can use blockquote with headers, paragraphs, tables and lists in it:<br />Tables can have or have not header and footer. This table is defined without any header and footer in it:<table><tbody><tr class="first"><td>red</td><td>fox</td><td class="num">0</td></tr><tr class="even"><td>blue</td><td>dolphin</td><td class="num">1000</td></tr><tr><td>green</td><td>leaf</td><td class="num">10000</td></tr></tbody></table></blockquote><p>This is yet another paragraph in the item.</p><ul><li>This is an item of unordered list <strong>(sublevel 3)</strong></li><li>This is the second item of the unordered list <em>(sublevel 3)</em><ol><ol><ol><li>This is a single item of ordered list in sublevel 6</li></ol></ol><p>and this is a paragraph in sublevel 4</p></ol></li><li><p>This is a new item with paragraph in sublevel 3.</p><ol><li>Start ordered list in sublevel 4 with code block: <pre><code>line 1
line 2
line 3</code></pre></li><li><p>Yet another item with code block:</p><pre><code> line 1
line 2
line 3</code></pre> This item finishes with this paragraph.</li></ol><p>Item in sublevel 3 can be continued with paragraphs.</p><pre><code> this is another
code block
in the
sublevel 3 item</code></pre></li></ul><ol><li>The last item in sublevel 3</li></ol><p>This is a continuous paragraph for item 2 in sublevel 2. You can use such structure to create difficult structured documents.</p><li>item 3 in sublevel 2</li></li></li></ol><ul><li>item 1 in sublevel 2 (new unordered list)</li><li>item 2 in sublevel 2</li><li>item 3 in sublevel 2</li></ul><ol><li>item 1 in sublevel 2 (new ordered list)</li><li>item 2 in sublevel 2</li><li>item 3 in sublevle 2</li></ol></li><li>item 2 in level 1</li><li>item 3 in level 1</li></ol><ul><li>new unordered list (item 1 in level 1)</li><li>level 2 in level 1</li><li>level 3 in level 1</li><li>level 4 in level 1</li></ul><h2>This is the last section of the test</h2><p>Single paragraph with '----' in it will be turned into separator:</p><hr /><p>And this is the last paragraph in the test. Be happy!</p>
## References ## References
- [[mdipierro]] web2py Manual, 5th Edition, lulu.com</code></pre><h3>Caveats</h3><p><code>&lt;ul/&gt;</code>, <code>&lt;ol/&gt;</code>, <code>&lt;code/&gt;</code>, <code>&lt;table/&gt;</code>, <code>&lt;blockquote/&gt;</code>, <code>&lt;h1/&gt;</code>, ..., <code>&lt;h6/&gt;</code> do not have <code>&lt;p&gt;...&lt;/p&gt;</code> around them.</p> - [[mdipierro]] web2py Manual, 5th Edition, lulu.com</code></pre><h3>Caveats</h3><p><code>&lt;ul/&gt;</code>, <code>&lt;ol/&gt;</code>, <code>&lt;code/&gt;</code>, <code>&lt;table/&gt;</code>, <code>&lt;blockquote/&gt;</code>, <code>&lt;h1/&gt;</code>, ..., <code>&lt;h6/&gt;</code> do not have <code>&lt;p&gt;...&lt;/p&gt;</code> around them.</p>
+8 -4
View File
@@ -116,13 +116,15 @@
{{elif request.function == 'ccache':}} {{elif request.function == 'ccache':}}
<h2>{{T("Cache")}}</h2> <h2>{{=T("Cache")}}</h2>
<div class="list">
<div class="list-header"> <div class="list-header">
<h3>{{T("Statistics")}}</h3> <h3>{{=T("Statistics")}}</h3>
</div> </div>
{{if request.env.web2py_runtime_gae:}}
{{=BEAUTIFY(total)}}
{{else:}}
<div class="list">
<div class="content"> <div class="content">
<h4>{{=T("Overview")}}</h4> <h4>{{=T("Overview")}}</h4>
<p>{{=T.M("Number of entries: **%s**", total['entries'])}}</p> <p>{{=T.M("Number of entries: **%s**", total['entries'])}}</p>
@@ -210,6 +212,8 @@
{{pass}} {{pass}}
</div> </div>
{{pass}}
<div class="list-header"> <div class="list-header">
<h3>{{=T("Manage Cache")}}</h3> <h3>{{=T("Manage Cache")}}</h3>
</div> </div>
+24 -4
View File
@@ -16,6 +16,8 @@ try:
except ImportError: except ImportError:
pgv = None pgv = None
is_gae = request.env.web2py_runtime_gae or False
# ## critical --- make a copy of the environment # ## critical --- make a copy of the environment
global_env = copy.copy(globals()) global_env = copy.copy(globals())
@@ -359,6 +361,10 @@ def state():
def ccache(): def ccache():
if is_gae:
form = FORM(
P(TAG.BUTTON(T("Clear CACHE?"), _type="submit", _name="yes", _value="yes")))
else:
cache.ram.initialize() cache.ram.initialize()
cache.disk.initialize() cache.disk.initialize()
@@ -372,23 +378,26 @@ def ccache():
) )
if form.accepts(request.vars, session): if form.accepts(request.vars, session):
session.flash = ""
if is_gae:
if request.vars.yes:
cache.ram.clear()
session.flash += T("Cache Cleared")
else:
clear_ram = False clear_ram = False
clear_disk = False clear_disk = False
session.flash = ""
if request.vars.yes: if request.vars.yes:
clear_ram = clear_disk = True clear_ram = clear_disk = True
if request.vars.ram: if request.vars.ram:
clear_ram = True clear_ram = True
if request.vars.disk: if request.vars.disk:
clear_disk = True clear_disk = True
if clear_ram: if clear_ram:
cache.ram.clear() cache.ram.clear()
session.flash += T("Ram Cleared") session.flash += T("Ram Cleared")
if clear_disk: if clear_disk:
cache.disk.clear() cache.disk.clear()
session.flash += T("Disk Cleared") session.flash += T("Disk Cleared")
redirect(URL(r=request)) redirect(URL(r=request))
try: try:
@@ -414,6 +423,7 @@ def ccache():
'oldest': time.time(), 'oldest': time.time(),
'keys': [] 'keys': []
} }
disk = copy.copy(ram) disk = copy.copy(ram)
total = copy.copy(ram) total = copy.copy(ram)
disk['keys'] = [] disk['keys'] = []
@@ -428,6 +438,16 @@ def ccache():
return (hours, minutes, seconds) return (hours, minutes, seconds)
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(): for key, value in cache.ram.storage.iteritems():
if isinstance(value, dict): if isinstance(value, dict):
ram['hits'] = value['hit_total'] - value['misses'] ram['hits'] = value['hit_total'] - value['misses']
@@ -468,7 +488,6 @@ def ccache():
if value[0] < disk['oldest']: if value[0] < disk['oldest']:
disk['oldest'] = value[0] disk['oldest'] = value[0]
disk['keys'].append((key, GetInHMS(time.time() - value[0]))) disk['keys'].append((key, GetInHMS(time.time() - value[0])))
finally: finally:
portalocker.unlock(locker) portalocker.unlock(locker)
locker.close() locker.close()
@@ -502,6 +521,7 @@ def ccache():
**dict(_class='cache-keys', **dict(_class='cache-keys',
_style="border-collapse: separate; border-spacing: .5em;")) _style="border-collapse: separate; border-spacing: .5em;"))
if not is_gae:
ram['keys'] = key_table(ram['keys']) ram['keys'] = key_table(ram['keys'])
disk['keys'] = key_table(disk['keys']) disk['keys'] = key_table(disk['keys'])
total['keys'] = key_table(total['keys']) total['keys'] = key_table(total['keys'])
+3 -1
View File
@@ -1,4 +1,4 @@
# coding: utf-8 # -*- coding: utf-8 -*-
{ {
'!langcode!': 'es', '!langcode!': 'es',
'!langname!': 'Español', '!langname!': 'Español',
@@ -10,6 +10,7 @@
'%Y-%m-%d %H:%M:%S': '%d/%m/%Y %H:%M:%S', '%Y-%m-%d %H:%M:%S': '%d/%m/%Y %H:%M:%S',
'(something like "it-it")': '(algo como "eso-eso")', '(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\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': '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', 'A new version of web2py is available: %s': 'Hay una nueva versión de web2py disponible: %s',
'About': 'Acerca de', 'About': 'Acerca de',
@@ -91,6 +92,7 @@
'Database': 'Base de datos', 'Database': 'Base de datos',
'Database %s select': 'selección en base de datos %s', 'Database %s select': 'selección en base de datos %s',
'database administration': 'administración base de datos', 'database administration': 'administración base de datos',
'Database Administration (appadmin)': 'Database Administration (appadmin)',
'Date and Time': 'Fecha y Hora', 'Date and Time': 'Fecha y Hora',
'db': 'bdd', 'db': 'bdd',
'DB Model': 'Modelo BDD', 'DB Model': 'Modelo BDD',
+1 -1
View File
@@ -36,7 +36,7 @@ audio {width:200px}
.hidden {display:none;visibility:visible} .hidden {display:none;visibility:visible}
.right {float:right; text-align:right} .right {float:right; text-align:right}
.left {float:left; text-align:left} .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 **/ /** end **/
/* Sticky footer begin */ /* Sticky footer begin */
@@ -20,10 +20,10 @@ jQuery(function(){
function hoverMenu(){ function hoverMenu(){
jQuery('ul.nav a.dropdown-toggle').parent().hover(function(){ jQuery('ul.nav a.dropdown-toggle').parent().hover(function(){
adjust_height_of_collapsed_nav(); 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); mi.children('.dropdown-menu').stop(true, true).delay(200).fadeIn(400);
}, function(){ }, function(){
mi = jQuery(this); var mi = jQuery(this);
mi.children('.dropdown-menu').stop(true, true).delay(200).fadeOut(function(){mi.removeClass('open')}); mi.children('.dropdown-menu').stop(true, true).delay(200).fadeOut(function(){mi.removeClass('open')});
}); });
} }
+8 -4
View File
@@ -116,13 +116,15 @@
{{elif request.function == 'ccache':}} {{elif request.function == 'ccache':}}
<h2>{{T("Cache")}}</h2> <h2>{{=T("Cache")}}</h2>
<div class="list">
<div class="list-header"> <div class="list-header">
<h3>{{T("Statistics")}}</h3> <h3>{{=T("Statistics")}}</h3>
</div> </div>
{{if request.env.web2py_runtime_gae:}}
{{=BEAUTIFY(total)}}
{{else:}}
<div class="list">
<div class="content"> <div class="content">
<h4>{{=T("Overview")}}</h4> <h4>{{=T("Overview")}}</h4>
<p>{{=T.M("Number of entries: **%s**", total['entries'])}}</p> <p>{{=T.M("Number of entries: **%s**", total['entries'])}}</p>
@@ -210,6 +212,8 @@
{{pass}} {{pass}}
</div> </div>
{{pass}}
<div class="list-header"> <div class="list-header">
<h3>{{=T("Manage Cache")}}</h3> <h3>{{=T("Manage Cache")}}</h3>
</div> </div>
+3 -1
View File
@@ -48,9 +48,11 @@
# default_language # default_language
# The language code (for example: en, it-it) optionally appears in the URL following # 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 # 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. # If languages=None, language support is disabled.
# The default_language, if any, is omitted from the URL. # 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) # root_static: list of static files accessed from root (by default, favicon.ico & robots.txt)
# (mapped to the default application's static/ directory) # (mapped to the default application's static/ directory)
# Each default (including domain-mapped) application has its own root-static files. # Each default (including domain-mapped) application has its own root-static files.
+1 -1
View File
@@ -528,7 +528,7 @@ def run_models_in(environment):
models_to_run = None models_to_run = None
for model in models: for model in models:
if response.models_to_run != models_to_run: 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): if isinstance(regex, list):
regex = re_compile('|'.join(regex)) regex = re_compile('|'.join(regex))
if models_to_run: if models_to_run:
+26 -21
View File
@@ -98,27 +98,32 @@ class RPXAccount(object):
def login_form(self): def login_form(self):
request = self.request request = self.request
args = request.args args = request.args
if self.embed: rpxform = """
JANRAIN_URL = \ <script type="text/javascript">
"https://%s.rpxnow.com/openid/embed?token_url=%s&language_preference=%s" (function() {
rpxform = IFRAME( if (typeof window.janrain !== 'object') window.janrain = {};
_src=JANRAIN_URL % ( if (typeof window.janrain.settings !== 'object') window.janrain.settings = {};
self.domain, self.token_url, self.language), janrain.settings.tokenUrl = '%s';
_scrolling="no", function isReady() { janrain.ready = true; };
_frameborder="no", if (document.addEventListener) {
_style="width:400px;height:240px;") document.addEventListener("DOMContentLoaded", isReady, false);
else: } else {
JANRAIN_URL = \ window.attachEvent('onload', isReady);
"https://%s.rpxnow.com/openid/v2/signin?token_url=%s" }
rpxform = DIV(SCRIPT(_src="https://rpxnow.com/openid/v2/widget", var e = document.createElement('script');
_type="text/javascript"), e.type = 'text/javascript';
SCRIPT("RPXNOW.overlay = true;", e.id = 'janrainAuthWidget';
"RPXNOW.language_preference = '%s';" % self.language, if (document.location.protocol === 'https:') {
"RPXNOW.realm = '%s';" % self.domain, e.src = 'https://rpxnow.com/js/lib/%s/engage.js';
"RPXNOW.token_url = '%s';" % self.token_url, } else {
"RPXNOW.show();", e.src = 'http://widget-cdn.rpxnow.com/js/lib/%s/engage.js';
_type="text/javascript")) }
return rpxform 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): def use_janrain(auth, filename='private/janrain.key', **kwargs):
+1 -1
View File
@@ -266,5 +266,5 @@ def populate_generator(table, default=True, compute=False, contents={}):
if __name__ == '__main__': if __name__ == '__main__':
ell = Learner() ell = Learner()
ell.loadd(eval(IUP)) ell.loadd(IUP)
print ell.generate(1000, prefix=None) print ell.generate(1000, prefix=None)
+5 -2
View File
@@ -8189,8 +8189,8 @@ def index():
limits = (offset,long(vars.get('limit',None) or 1000)+offset) limits = (offset,long(vars.get('limit',None) or 1000)+offset)
except ValueError: except ValueError:
return Row({'status':400,'error':'invalid limits','response':None}) return Row({'status':400,'error':'invalid limits','response':None})
if count > limits[1]-limits[0]: #if count > limits[1]-limits[0]:
return Row({'status':400,'error':'too many records','response':None}) # return Row({'status':400,'error':'too many records','response':None})
try: try:
response = dbset.select(limitby=limits,orderby=orderby,*fields) response = dbset.select(limitby=limits,orderby=orderby,*fields)
except ValueError: except ValueError:
@@ -8453,6 +8453,9 @@ def index():
columns = adapter.cursor.description columns = adapter.cursor.description
# reduce the column info down to just the field names # reduce the column info down to just the field names
fields = colnames or [f[0] for f in columns] 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 # will hold our finished resultset in a list
data = adapter._fetchall() data = adapter._fetchall()
# convert the list for each row into a dictionary so it's # convert the list for each row into a dictionary so it's
+2 -1
View File
@@ -3204,7 +3204,8 @@ class ExporterHTML(ExportClass):
ExportClass.__init__(self, rows) ExportClass.__init__(self, rows)
def export(self): 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): class ExporterXML(ExportClass):
label = 'XML' label = 'XML'
+1 -1
View File
@@ -2112,7 +2112,7 @@ class Auth(object):
success = False success = False
if row: if row:
userfield = self.settings.login_userfield or 'username' \ 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 is a service Ticket and RENEW flag respected
if ticket[0:3] == 'ST-' and \ if ticket[0:3] == 'ST-' and \
not ((row.renew and renew) ^ renew): not ((row.renew and renew) ^ renew):
+1 -1
View File
@@ -458,7 +458,7 @@ class IS_IN_SET(Validator):
regex1 = re.compile('\w+\.\w+') 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): class IS_IN_DB(Validator):