Projet

Général

Profil

« Précédent | Suivant » 

Révision 83c9a56a

Ajouté par Frédéric Péters il y a plus de 3 ans

adapt bits for py3 (#19613)

Voir les différences:

debian/debian_config.py
1
# This file is sourced by "execfile" from mandayejs.settings
1
# This file is sourced by "exec" from mandayejs.settings
2 2

  
3 3
import os
4 4

  
......
7 7
#
8 8
# hobotization (multitenant)
9 9
#
10
execfile('/usr/lib/hobo/debian_config_common.py')
10
exec(open('/usr/lib/hobo/debian_config_common.py').read())
11 11

  
12 12
TENANT_SETTINGS_LOADERS = ('hobo.multitenant.settings_loaders.MandayeJS',) + TENANT_SETTINGS_LOADERS
13 13

  
14 14
#
15 15
# local settings
16 16
#
17
execfile(os.path.join(ETC_DIR, 'settings.py'))
17
exec(open(os.path.join(ETC_DIR, 'settings.py')).read())
18 18

  
19 19
# run additional settings snippets
20
execfile('/usr/lib/hobo/debian_config_settings_d.py')
20
exec(open('/usr/lib/hobo/debian_config_settings_d.py').read())
debian/settings.py
9 9
# WARNING! Quick-start development settings unsuitable for production!
10 10
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
11 11

  
12
# This file is sourced by "execfile" from /usr/lib/mandayejs/debian_config.py
12
# This file is sourced by "exec" from /usr/lib/mandayejs/debian_config.py
13 13

  
14 14
# SECURITY WARNING: don't run with debug turned on in production!
15 15
DEBUG = False
mandayejs/applications/__init__.py
134 134
    SITE_AUTH_CHECKER = 'js/test/auth.checker.js'
135 135
    SITE_AUTH_COOKIE_KEYS = ['test']
136 136
    SITE_FORCE_REDIRECT_URL = '/whatever'
137
    SITE_FORM_SUBMIT_ELEMENT = None
137 138

  
138 139

  
139 140
# Duonet App Settings
mandayejs/mandaye/models.py
22 22
from django.db import models
23 23
from django.conf import settings
24 24
from django.utils.translation import ugettext_lazy as _
25
from django.utils.encoding import force_bytes
25 26

  
26 27
from jsonfield import JSONField
27 28

  
......
48 49
    def _get_cipher(self, iv):
49 50
        """Return cipher object
50 51
        """
51
        secret = sha256(settings.SECRET_KEY).digest()
52
        secret = sha256(force_bytes(settings.SECRET_KEY)).digest()
52 53
        return AES.new(secret, AES.MODE_CFB, iv)
53 54

  
54 55
    def encrypt(self,):
mandayejs/mandaye/utils.py
13 13
#
14 14
# You should have received a copy of the GNU Affero General Public License
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16

  
16 17
import os
17 18
import re
18 19
import json
19 20
import subprocess
20 21
import logging
21 22
import multiprocessing
22
import urlparse
23 23

  
24 24
from django.conf import settings
25
from django.http import SimpleCookie
25 26
from django.shortcuts import resolve_url
27
from django.utils.six.moves.urllib import parse as urlparse
26 28

  
27
from Cookie import SimpleCookie
28 29

  
29 30

  
30 31
logger = logging.getLogger(__name__)
mandayejs/mandaye/views.py
17 17
from __future__ import absolute_import
18 18

  
19 19
import logging
20
import urlparse
21 20

  
22 21
from django.contrib.auth.models import User
23 22
from django.contrib.auth.decorators import login_required
......
29 28
from django.template import RequestContext
30 29
from django.views.generic.base import TemplateView
31 30
from django.views.decorators.csrf import csrf_exempt
31
from django.utils.six.moves.urllib import parse as urlparse
32 32
from django.utils.translation import ugettext_lazy as _
33 33
from django.template import Template
34 34

  
mandayejs/settings.py
199 199
local_settings_file = os.environ.get('MANDAYEJS_SETTINGS_FILE',
200 200
        os.path.join(os.path.dirname(__file__), 'local_settings.py'))
201 201
if os.path.exists(local_settings_file):
202
    execfile(local_settings_file)
202
    exec(open(local_settings_file).read())
tests/test_api.py
27 27
def test_signed_api_get(client_service, url_signed):
28 28
    response = client_service.get(url_signed.url)
29 29
    if url_signed.orig == 'testserver':
30
        status_code = 200
30
        status_codes = (200,)
31 31
    else:
32
        status_code = 403
32
        status_codes = (401, 403)
33 33

  
34
    assert response.status_code == status_code
34
    assert response.status_code in status_codes
35 35

  
36
    if status_code == 200:
36
    if response.status_code == 200:
37 37
        assert {'login': '', 'password': ''} == response.data
38 38

  
39 39

  
tests/test_archimed.py
13 13

  
14 14

  
15 15
def get_base_dir(filename):
16
    return file(os.path.join(os.path.dirname(__file__), 'data', filename)).read()
16
    return open(os.path.join(os.path.dirname(__file__), 'data', filename)).read()
17 17

  
18 18

  
19 19
class MokcedRequestsResponse(mock.Mock):
tox.ini
1 1
[tox]
2
envlist = coverage-django111-pylint
2
envlist = py2-coverage-django111-pylint,py3-django111
3 3
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/mandayejs/
4 4

  
5 5
[testenv]
6
basepython = python2
7 6
usedevelop =
8 7
  coverage: True
9 8
setenv =

Formats disponibles : Unified diff