Enabled 3.5 on travis

This commit is contained in:
ilvalle
2016-06-02 14:57:48 +02:00
parent a1fd92b7f8
commit 707330accd
9 changed files with 42 additions and 34 deletions

View File

@@ -9,6 +9,7 @@ cache:
python:
- '2.7'
- 'pypy'
- '3.5'
install:
- |
@@ -24,8 +25,8 @@ install:
virtualenv --python="$PYENV_ROOT/versions/pypy-$PYPY_VERSION/bin/python" "$HOME/virtualenvs/pypy-$PYPY_VERSION"
source "$HOME/virtualenvs/pypy-$PYPY_VERSION/bin/activate"
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:
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then pip install --download-cache $HOME/.pip-cache coverage; fi;

View File

@@ -18,7 +18,7 @@ import pkgutil
import logging
from cgi import escape
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.utf8 import Utf8
@@ -809,7 +809,9 @@ class translator(object):
if mt is not None:
return mt
# 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
message = message.rsplit('##', 1)[0]
# guess translation same as original
@@ -819,7 +821,7 @@ class translator(object):
self.language_file != self.default_language_file:
write_dict(self.language_file, self.t)
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):
"""

View File

@@ -27,7 +27,7 @@ from gluon.storage import Storage, List
from gluon.http import HTTP
from gluon.fileutils import abspath, read_file
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
isfile = os.path.isfile
@@ -514,7 +514,7 @@ def load_routers(all_apps):
#
domains = dict()
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('/'))
if ':' in domain:
(domain, port) = domain.split(':')
@@ -620,7 +620,7 @@ def regex_url_in(request, environ):
if routes.routes_in:
environ = regex_filter_in(environ)
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
@@ -1074,7 +1074,7 @@ class MapUrlIn(object):
def sluggify(self):
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):
"""

View File

@@ -9,7 +9,7 @@ Background processes made simple
---------------------------------
"""
from __future__ import print_function
from gluon._compat import Queue
from gluon._compat import Queue, long
import os
import time

View File

@@ -10,6 +10,7 @@ from gluon.html import TAG, XmlComponent, xmlescape
from gluon.languages import lazyT
import gluon.contrib.rss2 as rss2
import json as json_parser
from gluon._compat import long
have_yaml = True
try:

View File

@@ -18,7 +18,7 @@ import os
import cgi
import logging
from re import compile, sub, escape, DOTALL
from gluon._compat import StringIO
from gluon._compat import StringIO, unicodeT
try:
# have web2py
@@ -812,9 +812,9 @@ class DummyResponse():
self.body.write(data.xml())
else:
# make it a string
if not isinstance(data, (str, unicode)):
if not isinstance(data, (str, unicodeT)):
data = str(data)
elif isinstance(data, unicode):
elif isinstance(data, unicodeT):
data = data.encode('utf8', 'xmlcharrefreplace')
data = cgi.escape(data, True).replace("'", "'")
self.body.write(data)
@@ -894,7 +894,7 @@ def render(content="hello world",
if not 'NOESCAPE' in context:
context['NOESCAPE'] = NOESCAPE
if isinstance(content, unicode):
if isinstance(content, unicodeT):
content = content.encode('utf8')
# save current response class

View File

@@ -1,28 +1,29 @@
import sys
from .test_http import *
from .test_cache import *
from .test_contenttype import *
from .test_compileapp import *
from .test_fileutils 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_routes 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':
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_contribs import *
from .test_old_doctests import *

View File

@@ -14,6 +14,7 @@ fix_sys_path(__file__)
from gluon.globals import Request, Response, Session
from gluon import URL
from gluon._compat import basestring
def setup_clean_session():
request = Request(env={})
@@ -158,31 +159,32 @@ class testResponse(unittest.TestCase):
current = setup_clean_session()
current.session._fixup_before_save()
cookie = str(current.response.cookies)
self.assertTrue('secure' not in cookie)
self.assertTrue('secure' not in cookie.lower())
current = setup_clean_session()
current.session.secure()
current.session._fixup_before_save()
cookie = str(current.response.cookies)
self.assertTrue('secure' in cookie)
self.assertTrue('secure' in cookie.lower())
def test_cookies_httponly(self):
current = setup_clean_session()
current.session._fixup_before_save()
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.session.httponly_cookies = True
current.session._fixup_before_save()
cookie = str(current.response.cookies)
self.assertTrue('httponly' in cookie)
self.assertTrue('httponly' in cookie.lower())
current = setup_clean_session()
current.session.httponly_cookies = False
current.session._fixup_before_save()
cookie = str(current.response.cookies)
self.assertTrue('httponly' not in cookie)
self.assertTrue('httponly' not in cookie.lower())
if __name__ == '__main__':
unittest.main()

1
requirements.txt Normal file
View File

@@ -0,0 +1 @@
pycrypto