Projet

Général

Profil

0001-add-django-1.11-support-19615.patch

Josué Kouka, 06 mars 2018 13:20

Télécharger (8,04 ko)

Voir les différences:

Subject: [PATCH] add django 1.11 support (#19615)

 mandayejs/applications/__init__.py | 11 ++++++-----
 mandayejs/applications/views.py    |  3 ++-
 mandayejs/mandaye/utils.py         |  4 +++-
 mandayejs/settings.py              | 27 +++++++++++++++++++++++----
 mandayejs/urls.py                  | 28 +++++++++++++++-------------
 tox.ini                            |  4 ++--
 6 files changed, 51 insertions(+), 26 deletions(-)
mandayejs/applications/__init__.py
20 20
from importlib import import_module
21 21

  
22 22
from django.conf import settings
23
from django.conf.urls import patterns, url
23
from django.conf.urls import url
24 24
from django.http import Http404
25 25
from django.core.exceptions import ImproperlyConfigured
26 26
from django.core.urlresolvers import resolve
27 27
from django.utils.text import slugify
28 28

  
29
from mandayejs.applications import views
30

  
29 31

  
30 32
def get_app_settings():
31 33
    module_name, app_settings = tuple(settings.SITE_APP.rsplit('.', 1))
......
192 194
        'account_details': '/DEFAULT/Ermes/Services/ILSClient.svc/RetrieveAccount',
193 195
    }
194 196

  
195
    urlpatterns = patterns(
196
        '',
197
    urlpatterns = [
197 198
        url(
198 199
            r'account/(?P<username>\w+)/$',
199
            'mandayejs.applications.views.archimed_account_details',
200
            views.archimed_account_details,
200 201
            name='archimed-account-details'),
201
    )
202
    ]
202 203

  
203 204
    SITE_LOGOUT_LOCATOR = '.account_logoff'
204 205

  
mandayejs/applications/views.py
25 25
from rest_framework.response import Response
26 26

  
27 27
from mandayejs.mandaye.models import UserCredentials
28
from mandayejs.applications import get_app_settings
29 28

  
30 29

  
31 30
class ArchimedAccountDetails(APIView):
......
41 40
        return response
42 41

  
43 42
    def get(self, request, *args, **kwargs):
43
        from mandayejs.applications import get_app_settings
44
        app_settings = get_app_settings()
44 45
        logger = logging.getLogger(__name__)
45 46
        app_settings = get_app_settings()
46 47
        ws_uri = request.build_absolute_uri(
mandayejs/mandaye/utils.py
26 26

  
27 27
from Cookie import SimpleCookie
28 28

  
29
from mandayejs.applications import get_app_settings
30 29

  
31 30
logger = logging.getLogger(__name__)
32 31

  
......
93 92
def get_logout_info(request):
94 93
    """Returns phantomjs logout prerequis
95 94
    """
95
    from mandayejs.applications import get_app_settings
96 96
    app_settings = get_app_settings()
97 97

  
98 98
    data = {}
......
120 120
def get_password_field():
121 121
    """Return name of the password field
122 122
    """
123
    from mandayejs.applications import get_app_settings
123 124
    app_settings = get_app_settings()
124 125
    try:
125 126
        field_name = [field.get('name') for field in app_settings.SITE_LOCATORS
......
132 133
def get_login_info(request, credentials):
133 134
    """Returns phantomjs login prerequis
134 135
    """
136
    from mandayejs.applications import get_app_settings
135 137
    app_settings = get_app_settings()
136 138
    auth_checker = os.path.join(
137 139
        settings.STATIC_ROOT, app_settings.SITE_AUTH_CHECKER)
mandayejs/settings.py
40 40
# SECURITY WARNING: don't run with debug turned on in production!
41 41
DEBUG = True
42 42

  
43
TEMPLATE_DEBUG = True
44

  
45 43
ALLOWED_HOSTS = []
46 44

  
47 45

  
......
115 113
STATIC_URL = '/_mandaye/static/'
116 114

  
117 115
# Serve xstatic files, required for gadjo
118
STATICFILES_FINDERS = global_settings.STATICFILES_FINDERS + \
119
            ('gadjo.finders.XStaticFinder',)
116
STATICFILES_FINDERS = list(global_settings.STATICFILES_FINDERS) + \
117
    ['gadjo.finders.XStaticFinder']
120 118

  
121 119
STATIC_DIRS = (
122 120
    os.path.join(BASE_DIR, 'static'),
123 121
)
124 122

  
123
TEMPLATES = [
124
    {
125
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
126
        'APP_DIRS': True,
127
        'DIRS': [],
128
        'OPTIONS': {
129
            'context_processors': [
130
                'django.contrib.auth.context_processors.auth',
131
                'django.template.context_processors.debug',
132
                'django.template.context_processors.i18n',
133
                'django.template.context_processors.media',
134
                'django.template.context_processors.static',
135
                'django.template.context_processors.tz',
136
                'django.contrib.messages.context_processors.messages',
137
                'django.template.context_processors.request',
138
            ],
139
        },
140
    },
141
]
142

  
143

  
125 144
LOGIN_URL = 'mellon_login'
126 145
LOGIN_LOGOUT = 'mellon_logout'
127 146
LOGIN_REDIRECT_URL = 'home'
mandayejs/urls.py
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16
from __future__ import absolute_import
17 17

  
18
from django.conf.urls import patterns, include, url
18
from django.conf.urls import include, url
19 19
from django.contrib import admin
20 20
from django.conf import settings
21 21

  
22 22
from mandayejs.applications import app_web_services
23
from mandayejs.mandaye import views
24
from mandayejs.mandaye.api import api
23 25

  
24
urlpatterns = patterns('',
25
    url(r'^_mandaye/home/$', 'mandayejs.mandaye.views.home', name='home'),
26
    url(r'^_mandaye/panel$', 'mandayejs.mandaye.views.panel', name='panel'),
27
    url(r'^_mandaye/associate/$', 'mandayejs.mandaye.views.associate', name='associate'),
28
    url(r'^_mandaye/dissociate/$', 'mandayejs.mandaye.views.dissociate', name='dissociate'),
29
    url(r'^_mandaye/post-login/$', 'mandayejs.mandaye.views.post_login', name='post-login'),
30
    url(r'^_mandaye/post-login-do/$', 'mandayejs.mandaye.views.post_login_do', name='post-login-do'),
26
urlpatterns = [
27
    url(r'^_mandaye/home/$', views.home, name='home'),
28
    url(r'^_mandaye/panel$', views.panel, name='panel'),
29
    url(r'^_mandaye/associate/$', views.associate, name='associate'),
30
    url(r'^_mandaye/dissociate/$', views.dissociate, name='dissociate'),
31
    url(r'^_mandaye/post-login/$', views.post_login, name='post-login'),
32
    url(r'^_mandaye/post-login-do/$', views.post_login_do, name='post-login-do'),
31 33
    url(r'^_mandaye/admin/', include(admin.site.urls)),
32 34
    url(r'^_mandaye/ws/(?P<path>.*)$', app_web_services, name='app-web-services'),
33
    url(r'^_mandaye/api/', 'mandayejs.mandaye.api.api', name='api')
34
)
35
    url(r'^_mandaye/api/', api, name='api')
36
]
35 37

  
36 38
if 'mellon' in settings.INSTALLED_APPS:
37
    urlpatterns += patterns('',
38
        url(r'^_mandaye/logout/$', 'mandayejs.mandaye.views.logout', name='logout'),
39
    urlpatterns += [
40
        url(r'^_mandaye/logout/$', views.logout, name='logout'),
39 41
        url(r'^_mandaye/accounts/mellon/', include('mellon.urls')),
40
    )
42
    ]
tox.ini
1 1
[tox]
2
envlist = coverage-django17-pylint,coverage-django18
2
envlist = coverage-{django18,django111}-pylint
3 3
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/mandayejs/
4 4

  
5 5
[testenv]
......
10 10
  MANDAYEJS_SETTINGS_FILE=tests/settings.py
11 11
  coverage: COVERAGE=--junitxml=test_results.xml --cov-report xml --cov=mandayejs/ --cov-config .coveragerc
12 12
deps =
13
  django17: django>1.7,<1.8
14 13
  django18: django>=1.8,<1.9
14
  django111: django>=1.11,<2.0
15 15
  pytest-cov
16 16
  pytest-django
17 17
  pytest>=3.3.0
18
-