From e6f84c45b90c41cad8f315c1dabc47f380eaf447 Mon Sep 17 00:00:00 2001 From: Massimo Date: Thu, 7 Nov 2013 10:25:29 -0600 Subject: [PATCH] fixed 1756:scripts/sessions2trash.py doesn't work with 'separate=True', thanks Paolo Valleri --- VERSION | 2 +- applications/admin/static/js/web2py.js | 16 ++++++++-------- applications/examples/static/js/web2py.js | 16 ++++++++-------- scripts/sessions2trash.py | 4 ++-- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/VERSION b/VERSION index 8a8f833f..7dab35f2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.7.4-stable+timestamp.2013.11.06.11.14.11 +Version 2.7.4-stable+timestamp.2013.11.07.10.23.59 diff --git a/applications/admin/static/js/web2py.js b/applications/admin/static/js/web2py.js index 3c8b568a..e714d3cc 100644 --- a/applications/admin/static/js/web2py.js +++ b/applications/admin/static/js/web2py.js @@ -250,22 +250,20 @@ }); }, + trap_form: function (action, target) { /* traps any LOADed form */ $('#' + target + ' form').each(function (i) { var form = $(this); - if(form.hasClass('no_trap')) { + if (form.hasClass('no_trap')) { return; } form.attr('data-w2p_target', target); - var url; + var url = form.attr('action'); - if(form.hasClass('trap_use_form_action')) { - /* submit using form own action, instead of component url */ - url = form.attr('action'); - } else { - /* should be there by default */ + if ((url === "") || (url === "#")) { + /* form has no action. Use component url. */ url = action; } @@ -275,8 +273,10 @@ web2py.ajax_page('post', url, form.serialize(), target, form); e.preventDefault(); }); - }); + }); }, + + ajax_page: function (method, action, data, target, element) { /* element is a new parameter, but should be put be put in front */ if(element == undefined) element = $(document); diff --git a/applications/examples/static/js/web2py.js b/applications/examples/static/js/web2py.js index 3c8b568a..e714d3cc 100644 --- a/applications/examples/static/js/web2py.js +++ b/applications/examples/static/js/web2py.js @@ -250,22 +250,20 @@ }); }, + trap_form: function (action, target) { /* traps any LOADed form */ $('#' + target + ' form').each(function (i) { var form = $(this); - if(form.hasClass('no_trap')) { + if (form.hasClass('no_trap')) { return; } form.attr('data-w2p_target', target); - var url; + var url = form.attr('action'); - if(form.hasClass('trap_use_form_action')) { - /* submit using form own action, instead of component url */ - url = form.attr('action'); - } else { - /* should be there by default */ + if ((url === "") || (url === "#")) { + /* form has no action. Use component url. */ url = action; } @@ -275,8 +273,10 @@ web2py.ajax_page('post', url, form.serialize(), target, form); e.preventDefault(); }); - }); + }); }, + + ajax_page: function (method, action, data, target, element) { /* element is a new parameter, but should be put be put in front */ if(element == undefined) element = $(document); diff --git a/scripts/sessions2trash.py b/scripts/sessions2trash.py index 0e0bf41a..6e11b2a0 100755 --- a/scripts/sessions2trash.py +++ b/scripts/sessions2trash.py @@ -115,8 +115,8 @@ class SessionSetFiles(SessionSet): def get(self): """Return list of SessionFile instances for existing sessions.""" - path = os.path.join(current.request.folder, 'sessions') - return [SessionFile(os.path.join(path, x)) for x in os.listdir(path)] + root_path = os.path.join(current.request.folder, 'sessions') + return [SessionFile(os.path.join(path, x)) for path,dirs,files in os.walk(root_path) for x in files] class SessionDb(object):