From 61c9b7991e02975ba79e25147e5dda472e0fcfa9 Mon Sep 17 00:00:00 2001 From: ilvalle Date: Mon, 4 Jul 2016 18:33:34 +0200 Subject: [PATCH 1/3] py35 fix cacheOnDisk on win --- gluon/cache.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gluon/cache.py b/gluon/cache.py index 814b5bc1..8a4b0a85 100644 --- a/gluon/cache.py +++ b/gluon/cache.py @@ -40,7 +40,7 @@ try: except ImportError: have_settings = False -from gluon._compat import pickle, thread +from gluon._compat import pickle, thread, to_bytes, to_native try: import psutil @@ -304,13 +304,13 @@ class CacheOnDisk(CacheAbstract): Windows doesn't allow \ / : * ? "< > | in filenames. To go around this encode the keys with base32. """ - return base64.b32encode(key) + return to_native(base64.b32encode(to_bytes(key))) def key_filter_out_windows(key): """ We need to decode the keys so regex based removal works. """ - return base64.b32decode(key) + return to_native(base64.b32decode(to_bytes(key))) self.key_filter_in = key_filter_in_windows self.key_filter_out = key_filter_out_windows From 5e94c11e4075c069ca4f46bc2f9c55f413d4f62a Mon Sep 17 00:00:00 2001 From: ilvalle Date: Sun, 3 Jul 2016 20:18:18 +0200 Subject: [PATCH 2/3] Enabled py35 on appveyor --- appveyor.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 49fe13c3..80e86c5d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,6 +4,11 @@ environment: matrix: - PYTHON: "C:/Python27" COVERAGE_PROCESS_START: gluon/tests/coverage.ini + PYTHON_ARCH: "64" + + - PYTHON: "C:/Python35" + COVERAGE_PROCESS_START: gluon/tests/coverage.ini + PYTHON_ARCH: "64" clone_depth: 50 @@ -16,10 +21,14 @@ install: - python get-pip.py - pip install codecov - git submodule update --init --recursive + - pip install pycrypto + # Check that we have the expected version and architecture for Python + - "python --version" + - "python -c \"import struct; print(struct.calcsize('P') * 8)\"" test_script: - python web2py.py --run_system_tests --with_coverage after_test: - coverage combine - - codecov \ No newline at end of file + - codecov From 967b2e27a7fe7f2595677300b29178044ab215fb Mon Sep 17 00:00:00 2001 From: ilvalle Date: Tue, 5 Jul 2016 19:44:00 +0200 Subject: [PATCH 3/3] added global_settings.is_py2 --- gluon/_compat.py | 5 ----- gluon/cache.py | 4 ++-- gluon/html.py | 6 ++---- gluon/settings.py | 3 +++ 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/gluon/_compat.py b/gluon/_compat.py index 44baefc3..1c3421c5 100644 --- a/gluon/_compat.py +++ b/gluon/_compat.py @@ -45,11 +45,6 @@ if PY2: unichr = unichr unicodeT = unicode - def implements_iterator(cls): - cls.next = cls.__next__ - del cls.__next__ - return cls - def implements_bool(cls): cls.__nonzero__ = cls.__bool__ del cls.__bool__ diff --git a/gluon/cache.py b/gluon/cache.py index 8a4b0a85..474910bb 100644 --- a/gluon/cache.py +++ b/gluon/cache.py @@ -40,7 +40,7 @@ try: except ImportError: have_settings = False -from gluon._compat import pickle, thread, to_bytes, to_native +from gluon._compat import pickle, thread, to_bytes, to_native, hashlib_md5 try: import psutil @@ -624,7 +624,7 @@ class Cache(object): cache_key.append(current.request.env.query_string) if lang_: cache_key.append(current.T.accepted_language) - cache_key = hashlib.md5('__'.join(cache_key)).hexdigest() + cache_key = hashlib_md5('__'.join(cache_key)).hexdigest() if prefix: cache_key = prefix + cache_key try: diff --git a/gluon/html.py b/gluon/html.py index 183bb4e0..11f9653e 100644 --- a/gluon/html.py +++ b/gluon/html.py @@ -21,7 +21,7 @@ import base64 from gluon import sanitizer, decoder import itertools from gluon._compat import reduce, pickle, copyreg, HTMLParser, name2codepoint, iteritems, unichr, unicodeT, urllib_quote, to_bytes, \ - to_native, to_unicode, _local_html_escape, basestring, urlencode + to_native, to_unicode, _local_html_escape, basestring, urlencode, implements_bool import marshal from gluon.storage import Storage @@ -671,7 +671,7 @@ def XML_pickle(data): return XML_unpickle, (marshal.dumps(str(data)),) copyreg.pickle(XML, XML_pickle, XML_unpickle) - +@implements_bool class DIV(XmlComponent): """ HTML helper, for easy generating and manipulating a DOM structure. @@ -824,8 +824,6 @@ class DIV(XmlComponent): """ return True - __nonzero__ = __bool__ - def _fixup(self): """ Handling of provided components. diff --git a/gluon/settings.py b/gluon/settings.py index 48fee6d4..5e2af7e0 100644 --- a/gluon/settings.py +++ b/gluon/settings.py @@ -10,6 +10,7 @@ import os import sys import platform from gluon.storage import Storage +from gluon._compat import PY2 global_settings = Storage() settings = global_settings # legacy compatibility @@ -40,3 +41,5 @@ global_settings.is_jython = \ global_settings.is_source = os.path.exists(os.path.join( global_settings.gluon_parent, 'web2py.py')) + +global_settings.is_py2 = PY2