diff --git a/applications/admin/controllers/debug.py b/applications/admin/controllers/debug.py index 06ba3b83..8a08dc83 100644 --- a/applications/admin/controllers/debug.py +++ b/applications/admin/controllers/debug.py @@ -1,12 +1,12 @@ import os import sys -import gluon.contrib.shell +#import gluon.contrib.shell import gluon.dal import gluon.html import gluon.validators import code -import thread from gluon.debug import communicate, web_debugger, qdb_debugger +from gluon._compat import thread import pydoc diff --git a/applications/admin/views/default/edit_js.html b/applications/admin/views/default/edit_js.html index a10f39d4..75aa74a5 100644 --- a/applications/admin/views/default/edit_js.html +++ b/applications/admin/views/default/edit_js.html @@ -25,11 +25,11 @@

{{if functions:}} - {{=B(T('exposes:'))}} {{=XML(', '.join([A(f,_target="_blank", _href=URL(a=app,c=controller,f=f)).xml() for f in functions]))}} + {{=B(T('exposes:'))}} {{=XML(b', '.join([A(f,_target="_blank", _href=URL(a=app,c=controller,f=f)).xml() for f in functions]))}} {{if editviewlinks:}}
{{=B(T('edit views:'))}} - {{=XML(', '.join([v.xml() for v in editviewlinks]))}} + {{=XML(b', '.join([v.xml() for v in editviewlinks]))}} {{pass}} {{pass}} {{if edit_controller:}} diff --git a/gluon/debug.py b/gluon/debug.py index 12db5a93..a4432590 100644 --- a/gluon/debug.py +++ b/gluon/debug.py @@ -13,8 +13,8 @@ Debugger support classes import logging import pdb -import Queue import sys +from gluon._compat import Queue logger = logging.getLogger("web2py") diff --git a/gluon/html.py b/gluon/html.py index 5ddf5dd4..183bb4e0 100644 --- a/gluon/html.py +++ b/gluon/html.py @@ -596,17 +596,18 @@ class XML(XmlComponent): for A, IMG and BlockQuote). The key is the tag; the value is a list of allowed attributes. """ - if sanitize: text = sanitizer.sanitize(text, permitted_tags, allowed_attributes) if isinstance(text, unicodeT): text = to_native(text.encode('utf8', 'xmlcharrefreplace')) + elif isinstance(text, bytes): + text = to_native(text) elif not isinstance(text, str): text = str(text) - self.text = to_bytes(text) + self.text = text def xml(self): - return self.text + return to_bytes(self.text) def __str__(self): return self.text diff --git a/gluon/main.py b/gluon/main.py index e438f4ba..81f04b90 100644 --- a/gluon/main.py +++ b/gluon/main.py @@ -482,7 +482,7 @@ def wsgibase(environ, responder): if request.ajax: if response.flash: http_response.headers['web2py-component-flash'] = \ - urllib2.quote(xmlescape(response.flash).replace('\n', '')) + urllib2.quote(xmlescape(response.flash).replace(b'\n', b'')) if response.js: http_response.headers['web2py-component-command'] = \ urllib2.quote(response.js.replace('\n', ''))