adapt bits for py3 (#19613)
This commit is contained in:
parent
eab3baded6
commit
83c9a56a67
|
@ -1,4 +1,4 @@
|
||||||
# This file is sourced by "execfile" from mandayejs.settings
|
# This file is sourced by "exec" from mandayejs.settings
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
@ -7,14 +7,14 @@ PROJECT_NAME = 'mandayejs'
|
||||||
#
|
#
|
||||||
# hobotization (multitenant)
|
# hobotization (multitenant)
|
||||||
#
|
#
|
||||||
execfile('/usr/lib/hobo/debian_config_common.py')
|
exec(open('/usr/lib/hobo/debian_config_common.py').read())
|
||||||
|
|
||||||
TENANT_SETTINGS_LOADERS = ('hobo.multitenant.settings_loaders.MandayeJS',) + TENANT_SETTINGS_LOADERS
|
TENANT_SETTINGS_LOADERS = ('hobo.multitenant.settings_loaders.MandayeJS',) + TENANT_SETTINGS_LOADERS
|
||||||
|
|
||||||
#
|
#
|
||||||
# local settings
|
# local settings
|
||||||
#
|
#
|
||||||
execfile(os.path.join(ETC_DIR, 'settings.py'))
|
exec(open(os.path.join(ETC_DIR, 'settings.py')).read())
|
||||||
|
|
||||||
# run additional settings snippets
|
# run additional settings snippets
|
||||||
execfile('/usr/lib/hobo/debian_config_settings_d.py')
|
exec(open('/usr/lib/hobo/debian_config_settings_d.py').read())
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
# WARNING! Quick-start development settings unsuitable for production!
|
# WARNING! Quick-start development settings unsuitable for production!
|
||||||
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
|
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
|
||||||
|
|
||||||
# This file is sourced by "execfile" from /usr/lib/mandayejs/debian_config.py
|
# This file is sourced by "exec" from /usr/lib/mandayejs/debian_config.py
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
|
|
|
@ -134,6 +134,7 @@ class Test(AppSettings):
|
||||||
SITE_AUTH_CHECKER = 'js/test/auth.checker.js'
|
SITE_AUTH_CHECKER = 'js/test/auth.checker.js'
|
||||||
SITE_AUTH_COOKIE_KEYS = ['test']
|
SITE_AUTH_COOKIE_KEYS = ['test']
|
||||||
SITE_FORCE_REDIRECT_URL = '/whatever'
|
SITE_FORCE_REDIRECT_URL = '/whatever'
|
||||||
|
SITE_FORM_SUBMIT_ELEMENT = None
|
||||||
|
|
||||||
|
|
||||||
# Duonet App Settings
|
# Duonet App Settings
|
||||||
|
|
|
@ -22,6 +22,7 @@ from Crypto import Random
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
from django.utils.encoding import force_bytes
|
||||||
|
|
||||||
from jsonfield import JSONField
|
from jsonfield import JSONField
|
||||||
|
|
||||||
|
@ -48,7 +49,7 @@ class UserCredentials(models.Model):
|
||||||
def _get_cipher(self, iv):
|
def _get_cipher(self, iv):
|
||||||
"""Return cipher object
|
"""Return cipher object
|
||||||
"""
|
"""
|
||||||
secret = sha256(settings.SECRET_KEY).digest()
|
secret = sha256(force_bytes(settings.SECRET_KEY)).digest()
|
||||||
return AES.new(secret, AES.MODE_CFB, iv)
|
return AES.new(secret, AES.MODE_CFB, iv)
|
||||||
|
|
||||||
def encrypt(self,):
|
def encrypt(self,):
|
||||||
|
|
|
@ -13,18 +13,19 @@
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
import subprocess
|
import subprocess
|
||||||
import logging
|
import logging
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import urlparse
|
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.http import SimpleCookie
|
||||||
from django.shortcuts import resolve_url
|
from django.shortcuts import resolve_url
|
||||||
|
from django.utils.six.moves.urllib import parse as urlparse
|
||||||
|
|
||||||
from Cookie import SimpleCookie
|
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import urlparse
|
|
||||||
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
|
@ -29,6 +28,7 @@ from django.shortcuts import render, resolve_url
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
from django.views.generic.base import TemplateView
|
from django.views.generic.base import TemplateView
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
|
from django.utils.six.moves.urllib import parse as urlparse
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.template import Template
|
from django.template import Template
|
||||||
|
|
||||||
|
|
|
@ -199,4 +199,4 @@ os.environ['QT_QPA_FONTDIR'] = '/usr/share/fonts'
|
||||||
local_settings_file = os.environ.get('MANDAYEJS_SETTINGS_FILE',
|
local_settings_file = os.environ.get('MANDAYEJS_SETTINGS_FILE',
|
||||||
os.path.join(os.path.dirname(__file__), 'local_settings.py'))
|
os.path.join(os.path.dirname(__file__), 'local_settings.py'))
|
||||||
if os.path.exists(local_settings_file):
|
if os.path.exists(local_settings_file):
|
||||||
execfile(local_settings_file)
|
exec(open(local_settings_file).read())
|
||||||
|
|
|
@ -27,13 +27,13 @@ def test_api_get(client, url):
|
||||||
def test_signed_api_get(client_service, url_signed):
|
def test_signed_api_get(client_service, url_signed):
|
||||||
response = client_service.get(url_signed.url)
|
response = client_service.get(url_signed.url)
|
||||||
if url_signed.orig == 'testserver':
|
if url_signed.orig == 'testserver':
|
||||||
status_code = 200
|
status_codes = (200,)
|
||||||
else:
|
else:
|
||||||
status_code = 403
|
status_codes = (401, 403)
|
||||||
|
|
||||||
assert response.status_code == status_code
|
assert response.status_code in status_codes
|
||||||
|
|
||||||
if status_code == 200:
|
if response.status_code == 200:
|
||||||
assert {'login': '', 'password': ''} == response.data
|
assert {'login': '', 'password': ''} == response.data
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ pytestmark = pytest.mark.django_db
|
||||||
|
|
||||||
|
|
||||||
def get_base_dir(filename):
|
def get_base_dir(filename):
|
||||||
return file(os.path.join(os.path.dirname(__file__), 'data', filename)).read()
|
return open(os.path.join(os.path.dirname(__file__), 'data', filename)).read()
|
||||||
|
|
||||||
|
|
||||||
class MokcedRequestsResponse(mock.Mock):
|
class MokcedRequestsResponse(mock.Mock):
|
||||||
|
|
3
tox.ini
3
tox.ini
|
@ -1,9 +1,8 @@
|
||||||
[tox]
|
[tox]
|
||||||
envlist = coverage-django111-pylint
|
envlist = py2-coverage-django111-pylint,py3-django111
|
||||||
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/mandayejs/
|
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/mandayejs/
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
basepython = python2
|
|
||||||
usedevelop =
|
usedevelop =
|
||||||
coverage: True
|
coverage: True
|
||||||
setenv =
|
setenv =
|
||||||
|
|
Reference in New Issue