From 561d031ef56d4aa36bdc77f374d2f291fb787824 Mon Sep 17 00:00:00 2001 From: Josue Kouka Date: Tue, 9 Feb 2016 17:02:27 +0100 Subject: [PATCH] handle login path prefix (#9885) --- README | 4 ++++ mandayejs/applications.py | 15 +++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/README b/README index a41e017..5c4b338 100644 --- a/README +++ b/README @@ -161,6 +161,10 @@ App Settings 'products': '/products/id', } + # If you class inherits from another and + # a SITE_LOGIN_PATH need to be set + SITE_LOGIN_PATH_PREFIX = '/wonderland/' + About Statics ------------- diff --git a/mandayejs/applications.py b/mandayejs/applications.py index a474043..47c3fe0 100644 --- a/mandayejs/applications.py +++ b/mandayejs/applications.py @@ -66,6 +66,9 @@ class AppSettingsMeta(type): if not dct.get('SITE_FORM_SUBMIT_ELEMENT', None): dct['SITE_FORM_SUBMIT_ELEMENT'] = 'input[type=submit], button' + if dct.get('SITE_LOGIN_PATH_PREFIX', None): + parent = bases[0] + dct['SITE_LOGIN_PATH'] = os.path.join(dct['SITE_LOGIN_PATH_PREFIX'], parent.SITE_LOGIN_PATH.strip('/')) return super(AppSettingsMeta, cls).__new__(cls, name, bases, dct) @@ -255,12 +258,16 @@ class Imuse(AppSettings): SITE_FORM_SUBMIT_ELEMENT = '#INDEX_BT_LOGIN' -class ImuseTeacherMontpellier(Imuse): - SITE_LOGIN_PATH = '/montpellier/extranet/login/ens_index_enseignant.php' +class ImuseTeacher(Imuse): + SITE_LOGIN_PATH = '/extranet/login/ens_index_enseignant.php' -class ImuseFamilyMontpellier(Imuse): - SITE_LOGIN_PATH = '/montpellier/extranet/login/usa_index_famille.php' +class ImuseFamily(Imuse): + SITE_LOGIN_PATH = '/extranet/login/usa_index_famille.php' SITE_LOGOUT_LOCATOR = '#MENU_FAMILLE_QUITTER' +class ImuseFamilyMontpellier(ImuseFamily): + SITE_LOGIN_PATH_PREFIX = '/montpellier/' + + -- 2.7.0