This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
mandaye/mandaye/configs/biblio_vincennes.py

79 lines
2.6 KiB
Python

from mandaye.filters.vincennes import biblio_html, biblio_html_login_page
from mandaye.filters.vincennes import biblio_associate_login, biblio_associate_req
from mandaye.filters.default import MandayeFilter
from mandaye.configs.vincennes import auth_vincennes, authform
biblio_mapping = [
{
'path': r'/',
'on_response': [{'filter': biblio_html}]
},
{
'path': r'/mandaye/login$',
'method': 'GET',
'response': {
'filter': authform.login,
'values': { 'associate_url': '/mandaye/associate' },
'condition': 'response.code==302',
},
},
{
'path': r'/mandaye/associate$',
'method': 'GET',
'target': 'http://biblio.vincennes.fr/sezhame/page/connexion-abonne',
'on_response': [{
'filter': biblio_associate_login,
'values': {
'action': '/mandaye/associate',
'template': 'biblio_associate.html',
},
}]
},
{
'path': r'/mandaye/associate$',
'method': 'POST',
'target': 'http://biblio.vincennes.fr/sezhame/page/connexion-abonne',
'on_request': [{'filter': biblio_associate_req}],
'on_response': [
{
'filter': authform.associate_submit,
'values': {
'site_name': 'biblio',
'connection_url': '/mandaye/connection'
},
'condition': "replay_response.status==302"
},
{
'filter': biblio_associate_login,
'values': {
'action': '/mandaye/associate',
'template': 'biblio_associate.html',
'error_msg': "Mauvais numéro ou mot de passe",
},
},
]
},
{
'path': r'/mandaye/connection$',
'method': 'GET',
'response': {
'filter': auth_vincennes.connection,
'values': {
'destination': 'https://test.vincennes.fr/comptecitoyen/auth',
'next_url': '/mandaye/login',
'service_name': 'biblio'
}
}
},
{
'path': r'/sezhame/page/connexion-abonne$',
'method': 'GET',
'on_response': [{'filter': biblio_html_login_page}]
},
]