Enabled 3.5 on travis
This commit is contained in:
+3
-2
@@ -9,6 +9,7 @@ cache:
|
|||||||
python:
|
python:
|
||||||
- '2.7'
|
- '2.7'
|
||||||
- 'pypy'
|
- 'pypy'
|
||||||
|
- '3.5'
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- |
|
- |
|
||||||
@@ -24,8 +25,8 @@ install:
|
|||||||
virtualenv --python="$PYENV_ROOT/versions/pypy-$PYPY_VERSION/bin/python" "$HOME/virtualenvs/pypy-$PYPY_VERSION"
|
virtualenv --python="$PYENV_ROOT/versions/pypy-$PYPY_VERSION/bin/python" "$HOME/virtualenvs/pypy-$PYPY_VERSION"
|
||||||
source "$HOME/virtualenvs/pypy-$PYPY_VERSION/bin/activate"
|
source "$HOME/virtualenvs/pypy-$PYPY_VERSION/bin/activate"
|
||||||
fi
|
fi
|
||||||
- pip install -e .
|
- if [[ $TRAVIS_PYTHON_VERSION == '3.5' ]]; then pip install --download-cache $HOME/.pip-cache pycrypto; fi;
|
||||||
|
- if [[ $TRAVIS_PYTHON_VERSION != '3.5' ]]; then pip install -e .; fi;
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then pip install --download-cache $HOME/.pip-cache coverage; fi;
|
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then pip install --download-cache $HOME/.pip-cache coverage; fi;
|
||||||
|
|||||||
+5
-3
@@ -18,7 +18,7 @@ import pkgutil
|
|||||||
import logging
|
import logging
|
||||||
from cgi import escape
|
from cgi import escape
|
||||||
from threading import RLock
|
from threading import RLock
|
||||||
from gluon._compat import copyreg, PY2, maketrans, iterkeys, unicodeT, to_unicode
|
from gluon._compat import copyreg, PY2, maketrans, iterkeys, unicodeT, to_unicode, to_bytes
|
||||||
|
|
||||||
from gluon.portalocker import read_locked, LockedFile
|
from gluon.portalocker import read_locked, LockedFile
|
||||||
from gluon.utf8 import Utf8
|
from gluon.utf8 import Utf8
|
||||||
@@ -809,7 +809,9 @@ class translator(object):
|
|||||||
if mt is not None:
|
if mt is not None:
|
||||||
return mt
|
return mt
|
||||||
# we did not find a translation
|
# we did not find a translation
|
||||||
if message.find('##') > 0 and not '\n' in message:
|
if message.find(to_bytes('##')) > 0:
|
||||||
|
pass
|
||||||
|
if message.find(to_bytes('##')) > 0 and not '\n' in message:
|
||||||
# remove comments
|
# remove comments
|
||||||
message = message.rsplit('##', 1)[0]
|
message = message.rsplit('##', 1)[0]
|
||||||
# guess translation same as original
|
# guess translation same as original
|
||||||
@@ -819,7 +821,7 @@ class translator(object):
|
|||||||
self.language_file != self.default_language_file:
|
self.language_file != self.default_language_file:
|
||||||
write_dict(self.language_file, self.t)
|
write_dict(self.language_file, self.t)
|
||||||
return regex_backslash.sub(
|
return regex_backslash.sub(
|
||||||
lambda m: m.group(1).translate(ttab_in), mt)
|
lambda m: m.group(1).translate(ttab_in), str(mt))
|
||||||
|
|
||||||
def params_substitution(self, message, symbols):
|
def params_substitution(self, message, symbols):
|
||||||
"""
|
"""
|
||||||
|
|||||||
+4
-4
@@ -27,7 +27,7 @@ from gluon.storage import Storage, List
|
|||||||
from gluon.http import HTTP
|
from gluon.http import HTTP
|
||||||
from gluon.fileutils import abspath, read_file
|
from gluon.fileutils import abspath, read_file
|
||||||
from gluon.settings import global_settings
|
from gluon.settings import global_settings
|
||||||
from gluon._compat import urllib_unquote, urllib_quote
|
from gluon._compat import urllib_unquote, urllib_quote, iteritems
|
||||||
|
|
||||||
isdir = os.path.isdir
|
isdir = os.path.isdir
|
||||||
isfile = os.path.isfile
|
isfile = os.path.isfile
|
||||||
@@ -514,7 +514,7 @@ def load_routers(all_apps):
|
|||||||
#
|
#
|
||||||
domains = dict()
|
domains = dict()
|
||||||
if routers.BASE.domains:
|
if routers.BASE.domains:
|
||||||
for (d, a) in routers.BASE.domains.iteritems():
|
for (d, a) in iteritems(routers.BASE.domains):
|
||||||
(domain, app) = (d.strip(':'), a.strip('/'))
|
(domain, app) = (d.strip(':'), a.strip('/'))
|
||||||
if ':' in domain:
|
if ':' in domain:
|
||||||
(domain, port) = domain.split(':')
|
(domain, port) = domain.split(':')
|
||||||
@@ -620,7 +620,7 @@ def regex_url_in(request, environ):
|
|||||||
if routes.routes_in:
|
if routes.routes_in:
|
||||||
environ = regex_filter_in(environ)
|
environ = regex_filter_in(environ)
|
||||||
request.env.update(
|
request.env.update(
|
||||||
(k.lower().replace('.', '_'), v) for k, v in environ.iteritems())
|
(k.lower().replace('.', '_'), v) for k, v in iteritems(environ))
|
||||||
|
|
||||||
# ##################################################
|
# ##################################################
|
||||||
# serve if a static file
|
# serve if a static file
|
||||||
@@ -1074,7 +1074,7 @@ class MapUrlIn(object):
|
|||||||
|
|
||||||
def sluggify(self):
|
def sluggify(self):
|
||||||
self.request.env.update(
|
self.request.env.update(
|
||||||
(k.lower().replace('.', '_'), v) for k, v in self.env.iteritems())
|
(k.lower().replace('.', '_'), v) for k, v in iteritems(self.env))
|
||||||
|
|
||||||
def update_request(self):
|
def update_request(self):
|
||||||
"""
|
"""
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ Background processes made simple
|
|||||||
---------------------------------
|
---------------------------------
|
||||||
"""
|
"""
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
from gluon._compat import Queue
|
from gluon._compat import Queue, long
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ from gluon.html import TAG, XmlComponent, xmlescape
|
|||||||
from gluon.languages import lazyT
|
from gluon.languages import lazyT
|
||||||
import gluon.contrib.rss2 as rss2
|
import gluon.contrib.rss2 as rss2
|
||||||
import json as json_parser
|
import json as json_parser
|
||||||
|
from gluon._compat import long
|
||||||
|
|
||||||
have_yaml = True
|
have_yaml = True
|
||||||
try:
|
try:
|
||||||
|
|||||||
+4
-4
@@ -18,7 +18,7 @@ import os
|
|||||||
import cgi
|
import cgi
|
||||||
import logging
|
import logging
|
||||||
from re import compile, sub, escape, DOTALL
|
from re import compile, sub, escape, DOTALL
|
||||||
from gluon._compat import StringIO
|
from gluon._compat import StringIO, unicodeT
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# have web2py
|
# have web2py
|
||||||
@@ -812,9 +812,9 @@ class DummyResponse():
|
|||||||
self.body.write(data.xml())
|
self.body.write(data.xml())
|
||||||
else:
|
else:
|
||||||
# make it a string
|
# make it a string
|
||||||
if not isinstance(data, (str, unicode)):
|
if not isinstance(data, (str, unicodeT)):
|
||||||
data = str(data)
|
data = str(data)
|
||||||
elif isinstance(data, unicode):
|
elif isinstance(data, unicodeT):
|
||||||
data = data.encode('utf8', 'xmlcharrefreplace')
|
data = data.encode('utf8', 'xmlcharrefreplace')
|
||||||
data = cgi.escape(data, True).replace("'", "'")
|
data = cgi.escape(data, True).replace("'", "'")
|
||||||
self.body.write(data)
|
self.body.write(data)
|
||||||
@@ -894,7 +894,7 @@ def render(content="hello world",
|
|||||||
if not 'NOESCAPE' in context:
|
if not 'NOESCAPE' in context:
|
||||||
context['NOESCAPE'] = NOESCAPE
|
context['NOESCAPE'] = NOESCAPE
|
||||||
|
|
||||||
if isinstance(content, unicode):
|
if isinstance(content, unicodeT):
|
||||||
content = content.encode('utf8')
|
content = content.encode('utf8')
|
||||||
|
|
||||||
# save current response class
|
# save current response class
|
||||||
|
|||||||
+16
-15
@@ -1,28 +1,29 @@
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
from .test_http import *
|
from .test_http import *
|
||||||
from .test_cache import *
|
|
||||||
from .test_contenttype import *
|
from .test_contenttype import *
|
||||||
from .test_compileapp import *
|
|
||||||
from .test_fileutils import *
|
from .test_fileutils import *
|
||||||
from .test_globals import *
|
from .test_globals import *
|
||||||
from .test_html import *
|
|
||||||
from .test_is_url import *
|
|
||||||
from .test_languages import *
|
|
||||||
from .test_router import *
|
|
||||||
from .test_recfile import *
|
from .test_recfile import *
|
||||||
from .test_routes import *
|
|
||||||
from .test_storage import *
|
from .test_storage import *
|
||||||
from .test_serializers import *
|
|
||||||
from .test_template import *
|
|
||||||
from .test_validators import *
|
|
||||||
from .test_utils import *
|
|
||||||
from .test_dal import *
|
|
||||||
from .test_tools import *
|
|
||||||
from .test_appadmin import *
|
|
||||||
from .test_scheduler import *
|
|
||||||
|
|
||||||
if sys.version[:3] == '2.7':
|
if sys.version[:3] == '2.7':
|
||||||
|
from .test_cache import *
|
||||||
|
from .test_compileapp import *
|
||||||
|
from .test_html import *
|
||||||
|
from .test_is_url import *
|
||||||
|
from .test_languages import *
|
||||||
|
from .test_router import *
|
||||||
|
from .test_routes import *
|
||||||
|
from .test_serializers import *
|
||||||
|
from .test_template import *
|
||||||
|
from .test_validators import *
|
||||||
|
from .test_utils import *
|
||||||
|
from .test_dal import *
|
||||||
|
from .test_tools import *
|
||||||
|
from .test_appadmin import *
|
||||||
|
from .test_scheduler import *
|
||||||
from .test_web import *
|
from .test_web import *
|
||||||
from .test_contribs import *
|
from .test_contribs import *
|
||||||
from .test_old_doctests import *
|
from .test_old_doctests import *
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ fix_sys_path(__file__)
|
|||||||
|
|
||||||
from gluon.globals import Request, Response, Session
|
from gluon.globals import Request, Response, Session
|
||||||
from gluon import URL
|
from gluon import URL
|
||||||
|
from gluon._compat import basestring
|
||||||
|
|
||||||
def setup_clean_session():
|
def setup_clean_session():
|
||||||
request = Request(env={})
|
request = Request(env={})
|
||||||
@@ -158,31 +159,32 @@ class testResponse(unittest.TestCase):
|
|||||||
current = setup_clean_session()
|
current = setup_clean_session()
|
||||||
current.session._fixup_before_save()
|
current.session._fixup_before_save()
|
||||||
cookie = str(current.response.cookies)
|
cookie = str(current.response.cookies)
|
||||||
self.assertTrue('secure' not in cookie)
|
self.assertTrue('secure' not in cookie.lower())
|
||||||
|
|
||||||
current = setup_clean_session()
|
current = setup_clean_session()
|
||||||
current.session.secure()
|
current.session.secure()
|
||||||
current.session._fixup_before_save()
|
current.session._fixup_before_save()
|
||||||
cookie = str(current.response.cookies)
|
cookie = str(current.response.cookies)
|
||||||
self.assertTrue('secure' in cookie)
|
self.assertTrue('secure' in cookie.lower())
|
||||||
|
|
||||||
def test_cookies_httponly(self):
|
def test_cookies_httponly(self):
|
||||||
current = setup_clean_session()
|
current = setup_clean_session()
|
||||||
current.session._fixup_before_save()
|
current.session._fixup_before_save()
|
||||||
cookie = str(current.response.cookies)
|
cookie = str(current.response.cookies)
|
||||||
self.assertTrue('httponly' in cookie)
|
# cookies in PY3 have capital letters
|
||||||
|
self.assertTrue('httponly' in cookie.lower())
|
||||||
|
|
||||||
current = setup_clean_session()
|
current = setup_clean_session()
|
||||||
current.session.httponly_cookies = True
|
current.session.httponly_cookies = True
|
||||||
current.session._fixup_before_save()
|
current.session._fixup_before_save()
|
||||||
cookie = str(current.response.cookies)
|
cookie = str(current.response.cookies)
|
||||||
self.assertTrue('httponly' in cookie)
|
self.assertTrue('httponly' in cookie.lower())
|
||||||
|
|
||||||
current = setup_clean_session()
|
current = setup_clean_session()
|
||||||
current.session.httponly_cookies = False
|
current.session.httponly_cookies = False
|
||||||
current.session._fixup_before_save()
|
current.session._fixup_before_save()
|
||||||
cookie = str(current.response.cookies)
|
cookie = str(current.response.cookies)
|
||||||
self.assertTrue('httponly' not in cookie)
|
self.assertTrue('httponly' not in cookie.lower())
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
pycrypto
|
||||||
Reference in New Issue
Block a user