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

View File

@@ -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

View File

@@ -25,11 +25,11 @@
<p class="formfield">
{{if functions:}}
<span style="text-align:left;" class="exposed">
{{=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]))}}
</span>
{{if editviewlinks:}}<br/>
{{=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:}}

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")

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

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', ''))