From afa5fac074edf5695f6da9a13cb013433242e8e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B8=D0=BC=20=D0=A9?= Date: Sat, 28 Oct 2017 19:26:34 +0300 Subject: [PATCH 1/4] Add reload --- gluon/_compat.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gluon/_compat.py b/gluon/_compat.py index a61ddc51..d8b7a495 100644 --- a/gluon/_compat.py +++ b/gluon/_compat.py @@ -35,6 +35,7 @@ if PY2: from gluon.contrib import ipaddress BytesIO = StringIO reduce = reduce + reload = reload hashlib_md5 = hashlib.md5 iterkeys = lambda d: d.iterkeys() itervalues = lambda d: d.itervalues() @@ -77,6 +78,7 @@ else: import pickle from io import StringIO, BytesIO import copyreg + from importlib import reload from functools import reduce from html.parser import HTMLParser from http import cookies as Cookie From dd14d1c8c9d10fb86d204462f0dc1b279c225101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B8=D0=BC=20=D0=A9?= Date: Sat, 28 Oct 2017 19:28:51 +0300 Subject: [PATCH 2/4] Add reload --- gluon/compileapp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gluon/compileapp.py b/gluon/compileapp.py index a59e96d1..1e0d3ef0 100644 --- a/gluon/compileapp.py +++ b/gluon/compileapp.py @@ -18,7 +18,7 @@ import fnmatch import os import copy 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.template import parse_template from gluon.restricted import restricted, compile2 From 2e572aee9a80160c35184fdf1dfe72bb3f61ad44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B8=D0=BC=20=D0=A9?= Date: Sat, 28 Oct 2017 19:29:55 +0300 Subject: [PATCH 3/4] Update custom_import.py --- gluon/custom_import.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gluon/custom_import.py b/gluon/custom_import.py index d9eab5b2..e12dea42 100644 --- a/gluon/custom_import.py +++ b/gluon/custom_import.py @@ -8,7 +8,7 @@ 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 sys import threading From c7d415fefdb97b8d056b542cf9684afc4c5e290d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B8=D0=BC=20=D0=A9?= Date: Sat, 28 Oct 2017 19:32:48 +0300 Subject: [PATCH 4/4] compatible unicode --- gluon/languages.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gluon/languages.py b/gluon/languages.py index aff3db14..0d8bd4a2 100644 --- a/gluon/languages.py +++ b/gluon/languages.py @@ -110,15 +110,17 @@ def markmin(s): def upper_fun(s): - return unicode(s, 'utf-8').upper().encode('utf-8') + return to_unicode(s).upper() def title_fun(s): - return unicode(s, 'utf-8').title().encode('utf-8') + return to_unicode(s).title() 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_out = maketrans('\x1c\x1d\x1e\x1f', "\\%{}")