Merge pull request #1793 from sherdim/master
A step to PY3 closes #1792 and may be closes #1727
This commit is contained in:
@@ -35,6 +35,7 @@ if PY2:
|
|||||||
from gluon.contrib import ipaddress
|
from gluon.contrib import ipaddress
|
||||||
BytesIO = StringIO
|
BytesIO = StringIO
|
||||||
reduce = reduce
|
reduce = reduce
|
||||||
|
reload = reload
|
||||||
hashlib_md5 = hashlib.md5
|
hashlib_md5 = hashlib.md5
|
||||||
iterkeys = lambda d: d.iterkeys()
|
iterkeys = lambda d: d.iterkeys()
|
||||||
itervalues = lambda d: d.itervalues()
|
itervalues = lambda d: d.itervalues()
|
||||||
@@ -77,6 +78,7 @@ else:
|
|||||||
import pickle
|
import pickle
|
||||||
from io import StringIO, BytesIO
|
from io import StringIO, BytesIO
|
||||||
import copyreg
|
import copyreg
|
||||||
|
from importlib import reload
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
from html.parser import HTMLParser
|
from html.parser import HTMLParser
|
||||||
from http import cookies as Cookie
|
from http import cookies as Cookie
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@ import fnmatch
|
|||||||
import os
|
import os
|
||||||
import copy
|
import copy
|
||||||
import random
|
import random
|
||||||
from gluon._compat import builtin, PY2, unicodeT, to_native, to_bytes, iteritems, basestring, reduce, xrange, long
|
from gluon._compat import builtin, PY2, unicodeT, to_native, to_bytes, iteritems, basestring, reduce, xrange, long, reload
|
||||||
from gluon.storage import Storage, List
|
from gluon.storage import Storage, List
|
||||||
from gluon.template import parse_template
|
from gluon.template import parse_template
|
||||||
from gluon.restricted import restricted, compile2
|
from gluon.restricted import restricted, compile2
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
Support for smart import syntax for web2py applications
|
Support for smart import syntax for web2py applications
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
"""
|
"""
|
||||||
from gluon._compat import builtin, unicodeT, PY2, to_native
|
from gluon._compat import builtin, unicodeT, PY2, to_native, reload
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
|
|||||||
+5
-3
@@ -110,15 +110,17 @@ def markmin(s):
|
|||||||
|
|
||||||
|
|
||||||
def upper_fun(s):
|
def upper_fun(s):
|
||||||
return unicode(s, 'utf-8').upper().encode('utf-8')
|
return to_unicode(s).upper()
|
||||||
|
|
||||||
|
|
||||||
def title_fun(s):
|
def title_fun(s):
|
||||||
return unicode(s, 'utf-8').title().encode('utf-8')
|
return to_unicode(s).title()
|
||||||
|
|
||||||
|
|
||||||
def cap_fun(s):
|
def cap_fun(s):
|
||||||
return unicode(s, 'utf-8').capitalize().encode('utf-8')
|
return to_unicode(s).capitalize()
|
||||||
|
|
||||||
|
|
||||||
ttab_in = maketrans("\\%{}", '\x1c\x1d\x1e\x1f')
|
ttab_in = maketrans("\\%{}", '\x1c\x1d\x1e\x1f')
|
||||||
ttab_out = maketrans('\x1c\x1d\x1e\x1f', "\\%{}")
|
ttab_out = maketrans('\x1c\x1d\x1e\x1f', "\\%{}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user