add django 1.11 support (#19615)

This commit is contained in:
Josue Kouka 2018-02-19 14:52:38 +01:00
parent 7c2b416140
commit c23f4a3b5e
6 changed files with 52 additions and 27 deletions

View File

@ -20,12 +20,14 @@ import os
from importlib import import_module
from django.conf import settings
from django.conf.urls import patterns, url
from django.conf.urls import url
from django.http import Http404
from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import resolve
from django.utils.text import slugify
from mandayejs.applications import views
def get_app_settings():
module_name, app_settings = tuple(settings.SITE_APP.rsplit('.', 1))
@ -192,13 +194,12 @@ class Archimed(AppSettings):
'account_details': '/DEFAULT/Ermes/Services/ILSClient.svc/RetrieveAccount',
}
urlpatterns = patterns(
'',
urlpatterns = [
url(
r'account/(?P<username>\w+)/$',
'mandayejs.applications.views.archimed_account_details',
views.archimed_account_details,
name='archimed-account-details'),
)
]
SITE_LOGOUT_LOCATOR = '.account_logoff'

View File

@ -25,7 +25,6 @@ from rest_framework.views import APIView
from rest_framework.response import Response
from mandayejs.mandaye.models import UserCredentials
from mandayejs.applications import get_app_settings
class ArchimedAccountDetails(APIView):
@ -41,6 +40,8 @@ class ArchimedAccountDetails(APIView):
return response
def get(self, request, *args, **kwargs):
from mandayejs.applications import get_app_settings
app_settings = get_app_settings()
logger = logging.getLogger(__name__)
app_settings = get_app_settings()
ws_uri = request.build_absolute_uri(

View File

@ -26,7 +26,6 @@ from django.shortcuts import resolve_url
from Cookie import SimpleCookie
from mandayejs.applications import get_app_settings
logger = logging.getLogger(__name__)
@ -93,6 +92,7 @@ def cookie_builder(headers):
def get_logout_info(request):
"""Returns phantomjs logout prerequis
"""
from mandayejs.applications import get_app_settings
app_settings = get_app_settings()
data = {}
@ -120,6 +120,7 @@ def get_logout_info(request):
def get_password_field():
"""Return name of the password field
"""
from mandayejs.applications import get_app_settings
app_settings = get_app_settings()
try:
field_name = [field.get('name') for field in app_settings.SITE_LOCATORS
@ -132,6 +133,7 @@ def get_password_field():
def get_login_info(request, credentials):
"""Returns phantomjs login prerequis
"""
from mandayejs.applications import get_app_settings
app_settings = get_app_settings()
auth_checker = os.path.join(
settings.STATIC_ROOT, app_settings.SITE_AUTH_CHECKER)

View File

@ -40,8 +40,6 @@ SECRET_KEY = 'xlf$@r5j*6p5-l#q=bg&t$mlhf=v@fq9^xfs#%712zndtu2#2@'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
@ -115,13 +113,34 @@ STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATIC_URL = '/_mandaye/static/'
# Serve xstatic files, required for gadjo
STATICFILES_FINDERS = global_settings.STATICFILES_FINDERS + \
('gadjo.finders.XStaticFinder',)
STATICFILES_FINDERS = list(global_settings.STATICFILES_FINDERS) + \
['gadjo.finders.XStaticFinder']
STATIC_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'APP_DIRS': True,
'DIRS': [],
'OPTIONS': {
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',
'django.template.context_processors.request',
],
},
},
]
LOGIN_URL = 'mellon_login'
LOGIN_LOGOUT = 'mellon_logout'
LOGIN_REDIRECT_URL = 'home'

View File

@ -15,27 +15,29 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import absolute_import
from django.conf.urls import patterns, include, url
from django.conf.urls import include, url
from django.contrib import admin
from django.conf import settings
from mandayejs.applications import app_web_services
from mandayejs.mandaye import views
from mandayejs.mandaye.api import api, api_stats
urlpatterns = patterns('',
url(r'^_mandaye/home/$', 'mandayejs.mandaye.views.home', name='home'),
url(r'^_mandaye/panel$', 'mandayejs.mandaye.views.panel', name='panel'),
url(r'^_mandaye/associate/$', 'mandayejs.mandaye.views.associate', name='associate'),
url(r'^_mandaye/dissociate/$', 'mandayejs.mandaye.views.dissociate', name='dissociate'),
url(r'^_mandaye/post-login/$', 'mandayejs.mandaye.views.post_login', name='post-login'),
url(r'^_mandaye/post-login-do/$', 'mandayejs.mandaye.views.post_login_do', name='post-login-do'),
urlpatterns = [
url(r'^_mandaye/home/$', views.home, name='home'),
url(r'^_mandaye/panel$', views.panel, name='panel'),
url(r'^_mandaye/associate/$', views.associate, name='associate'),
url(r'^_mandaye/dissociate/$', views.dissociate, name='dissociate'),
url(r'^_mandaye/post-login/$', views.post_login, name='post-login'),
url(r'^_mandaye/post-login-do/$', views.post_login_do, name='post-login-do'),
url(r'^_mandaye/admin/', include(admin.site.urls)),
url(r'^_mandaye/ws/(?P<path>.*)$', app_web_services, name='app-web-services'),
url(r'^_mandaye/api/$', 'mandayejs.mandaye.api.api', name='api'),
url(r'^_mandaye/api/stats/$', 'mandayejs.mandaye.api.api_stats', name='api-stats')
)
url(r'^_mandaye/api/$', api, name='api'),
url(r'^_mandaye/api/stats/$', api_stats, name='api-stats')
]
if 'mellon' in settings.INSTALLED_APPS:
urlpatterns += patterns('',
url(r'^_mandaye/logout/$', 'mandayejs.mandaye.views.logout', name='logout'),
urlpatterns += [
url(r'^_mandaye/logout/$', views.logout, name='logout'),
url(r'^_mandaye/accounts/mellon/', include('mellon.urls')),
)
]

View File

@ -1,5 +1,5 @@
[tox]
envlist = coverage-django17-pylint,coverage-django18
envlist = coverage-{django18,django111}-pylint
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/mandayejs/
[testenv]
@ -10,8 +10,8 @@ setenv =
MANDAYEJS_SETTINGS_FILE=tests/settings.py
coverage: COVERAGE=--junitxml=test_results.xml --cov-report xml --cov=mandayejs/ --cov-config .coveragerc
deps =
django17: django>1.7,<1.8
django18: django>=1.8,<1.9
django111: django>=1.11,<2.0
pytest-cov
pytest-django
pytest>=3.3.0