From 4ec117b9431dde3632e9e83994943c9f295c55fd Mon Sep 17 00:00:00 2001 From: mdipierro Date: Mon, 6 Aug 2012 06:28:32 -0500 Subject: [PATCH] fixed encoding-decoding of flash, thanks Anthony --- VERSION | 2 +- applications/admin/static/js/web2py.js | 2 +- applications/examples/static/js/web2py.js | 2 +- applications/welcome/static/js/web2py.js | 2 +- gluon/main.py | 11 +++++++---- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/VERSION b/VERSION index bfb207e3..91a51396 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.00.0 (2012-08-05 21:35:52) dev +Version 2.00.0 (2012-08-06 06:28:28) dev diff --git a/applications/admin/static/js/web2py.js b/applications/admin/static/js/web2py.js index eb1e3b09..a8581e5a 100644 --- a/applications/admin/static/js/web2py.js +++ b/applications/admin/static/js/web2py.js @@ -97,7 +97,7 @@ function web2py_ajax_page(method, action, data, target) { if(command) eval(decodeURIComponent(command)); if(flash) - jQuery('.flash').html(decodeURIComponent(flash)).slideDown(); + jQuery('.flash').html(flash).slideDown(); } }); } diff --git a/applications/examples/static/js/web2py.js b/applications/examples/static/js/web2py.js index eb1e3b09..a8581e5a 100644 --- a/applications/examples/static/js/web2py.js +++ b/applications/examples/static/js/web2py.js @@ -97,7 +97,7 @@ function web2py_ajax_page(method, action, data, target) { if(command) eval(decodeURIComponent(command)); if(flash) - jQuery('.flash').html(decodeURIComponent(flash)).slideDown(); + jQuery('.flash').html(flash).slideDown(); } }); } diff --git a/applications/welcome/static/js/web2py.js b/applications/welcome/static/js/web2py.js index eb1e3b09..a8581e5a 100644 --- a/applications/welcome/static/js/web2py.js +++ b/applications/welcome/static/js/web2py.js @@ -97,7 +97,7 @@ function web2py_ajax_page(method, action, data, target) { if(command) eval(decodeURIComponent(command)); if(flash) - jQuery('.flash').html(decodeURIComponent(flash)).slideDown(); + jQuery('.flash').html(flash).slideDown(); } }); } diff --git a/gluon/main.py b/gluon/main.py index ee891c53..d1009df9 100644 --- a/gluon/main.py +++ b/gluon/main.py @@ -87,7 +87,7 @@ from dal import BaseAdapter from settings import global_settings from validators import CRYPT from cache import Cache -from html import URL as Url +from html import URL as Url, xmlescape from utils import is_valid_ip_address import newcron import rewrite @@ -547,10 +547,13 @@ def wsgibase(environ, responder): # ################################################## if request.cid: - if response.flash and not 'web2py-component-flash' in http_response.headers: + if response.flash and not 'web2py-component-flash' \ + in http_response.headers: http_response.headers['web2py-component-flash'] = \ - urllib2.quote(str(response.flash).replace('\n','')) - if response.js and not 'web2py-component-command' in http_response.headers: + urllib2.quote(xmlescape(response.flash)\ + .replace('\n','')) + if response.js and not 'web2py-component-command' \ + in http_response.headers: http_response.headers['web2py-component-command'] = \ response.js.replace('\n','') if session._forget and \