py3 fixes for admin app

This commit is contained in:
ilvalle
2016-06-25 17:36:37 +02:00
parent d429554c5b
commit f343fab528
5 changed files with 10 additions and 9 deletions
+1 -1
View File
@@ -13,8 +13,8 @@ Debugger support classes
import logging
import pdb
import Queue
import sys
from gluon._compat import Queue
logger = logging.getLogger("web2py")
+4 -3
View File
@@ -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
+1 -1
View File
@@ -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', ''))