misc: apply double-quote-string-fixer (#79788)

This commit is contained in:
Valentin Deniaud 2023-08-16 10:08:30 +02:00
parent 6e7ac8c145
commit 40142de8d2
182 changed files with 3944 additions and 3944 deletions

View File

@ -2,23 +2,23 @@ import pytest
def pytest_addoption(parser): def pytest_addoption(parser):
parser.addoption("--url", help="Url of a passerelle Caluire Axel connector instance") parser.addoption('--url', help='Url of a passerelle Caluire Axel connector instance')
parser.addoption("--nameid", help="Publik Name ID") parser.addoption('--nameid', help='Publik Name ID')
parser.addoption("--firstname", help="first name of a user") parser.addoption('--firstname', help='first name of a user')
parser.addoption("--lastname", help="Last name of a user") parser.addoption('--lastname', help='Last name of a user')
parser.addoption("--family", help="Family ID") parser.addoption('--family', help='Family ID')
@pytest.fixture(scope='session') @pytest.fixture(scope='session')
def conn(request): def conn(request):
return request.config.getoption("--url") return request.config.getoption('--url')
@pytest.fixture(scope='session') @pytest.fixture(scope='session')
def user(request): def user(request):
return { return {
'name_id': request.config.getoption("--nameid"), 'name_id': request.config.getoption('--nameid'),
'first_name': request.config.getoption("--firstname"), 'first_name': request.config.getoption('--firstname'),
'last_name': request.config.getoption("--lastname"), 'last_name': request.config.getoption('--lastname'),
'family': request.config.getoption("--family"), 'family': request.config.getoption('--family'),
} }

View File

@ -12,7 +12,7 @@ def test_link(conn, user):
'NOM': user['last_name'], 'NOM': user['last_name'],
'PRENOM': user['first_name'], 'PRENOM': user['first_name'],
} }
print("Creating link with the following payload:") print('Creating link with the following payload:')
pprint.pprint(payload) pprint.pprint(payload)
resp = requests.post(url, json=payload) resp = requests.post(url, json=payload)
resp.raise_for_status() resp.raise_for_status()
@ -21,7 +21,7 @@ def test_link(conn, user):
assert res['err'] == 0 assert res['err'] == 0
print('\n') print('\n')
print("GET family info") print('GET family info')
url = conn + '/family_info?NameID=%s' % name_id url = conn + '/family_info?NameID=%s' % name_id
resp = requests.get(url) resp = requests.get(url)
resp.raise_for_status() resp.raise_for_status()
@ -30,7 +30,7 @@ def test_link(conn, user):
assert data['err'] == 0 assert data['err'] == 0
print('\n') print('\n')
print("GET children info") print('GET children info')
url = conn + '/children_info?NameID=%s' % (name_id) url = conn + '/children_info?NameID=%s' % (name_id)
resp = requests.get(url) resp = requests.get(url)
resp.raise_for_status() resp.raise_for_status()
@ -40,7 +40,7 @@ def test_link(conn, user):
print('\n') print('\n')
for child in data['data']['MEMBRE']: for child in data['data']['MEMBRE']:
print("GET child info") print('GET child info')
url = conn + '/child_info?NameID=%s&idpersonne=%s' % (name_id, child['IDENT']) url = conn + '/child_info?NameID=%s&idpersonne=%s' % (name_id, child['IDENT'])
resp = requests.get(url) resp = requests.get(url)
resp.raise_for_status() resp.raise_for_status()
@ -49,7 +49,7 @@ def test_link(conn, user):
assert res['err'] == 0 assert res['err'] == 0
print('\n') print('\n')
print("and GET school info") print('and GET school info')
url = conn + '/child_schooling_info?NameID=%s&idpersonne=%s&schooling_date=%s' % ( url = conn + '/child_schooling_info?NameID=%s&idpersonne=%s&schooling_date=%s' % (
name_id, name_id,
child['IDENT'], child['IDENT'],
@ -62,7 +62,7 @@ def test_link(conn, user):
assert res['err'] == 0 assert res['err'] == 0
print('\n') print('\n')
print("and GET activities info") print('and GET activities info')
url = conn + '/child_activities_info?NameID=%s&idpersonne=%s&schooling_date=%s' % ( url = conn + '/child_activities_info?NameID=%s&idpersonne=%s&schooling_date=%s' % (
name_id, name_id,
child['IDENT'], child['IDENT'],
@ -75,7 +75,7 @@ def test_link(conn, user):
assert res['err'] == 0 assert res['err'] == 0
print('\n') print('\n')
print("GET school list") print('GET school list')
url = conn + '/school_list' url = conn + '/school_list'
payload = { payload = {
'num': data['data']['RESPONSABLE1']['ADRESSE']['NORUE'], 'num': data['data']['RESPONSABLE1']['ADRESSE']['NORUE'],
@ -92,7 +92,7 @@ def test_link(conn, user):
print('\n') print('\n')
return return
print("Deleting link") print('Deleting link')
url = conn + '/unlink?NameID=%s' % name_id url = conn + '/unlink?NameID=%s' % name_id
resp = requests.post(url) resp = requests.post(url)
resp.raise_for_status() resp.raise_for_status()

View File

@ -5,25 +5,25 @@ import pytest
def pytest_addoption(parser): def pytest_addoption(parser):
parser.addoption("--cmis-connector-url", help="Url of a passerelle CMIS connector instance") parser.addoption('--cmis-connector-url', help='Url of a passerelle CMIS connector instance')
parser.addoption("--cmis-endpoint", help="Url of a passerelle CMIS endpoint") parser.addoption('--cmis-endpoint', help='Url of a passerelle CMIS endpoint')
parser.addoption("--cmis-username", help="Username for the CMIS endpoint") parser.addoption('--cmis-username', help='Username for the CMIS endpoint')
parser.addoption("--cmis-password", help="Password for the CMIS endpoint") parser.addoption('--cmis-password', help='Password for the CMIS endpoint')
parser.addoption("--preserve-tree", action="store_true", default=False, help="Preserve test directory") parser.addoption('--preserve-tree', action='store_true', default=False, help='Preserve test directory')
@pytest.fixture(scope='session') @pytest.fixture(scope='session')
def cmisclient(request): def cmisclient(request):
return cmislib.CmisClient( return cmislib.CmisClient(
request.config.getoption("--cmis-endpoint"), request.config.getoption('--cmis-endpoint'),
request.config.getoption("--cmis-username"), request.config.getoption('--cmis-username'),
request.config.getoption("--cmis-password"), request.config.getoption('--cmis-password'),
) )
@pytest.fixture(scope='session') @pytest.fixture(scope='session')
def cmis_connector(request): def cmis_connector(request):
return request.config.getoption("--cmis-connector-url") return request.config.getoption('--cmis-connector-url')
@pytest.fixture(scope='session') @pytest.fixture(scope='session')
@ -31,6 +31,6 @@ def cmis_tmpdir(cmisclient, request):
path = 'test-%s' % random.randint(0, 10000) path = 'test-%s' % random.randint(0, 10000)
folder = cmisclient.defaultRepository.rootFolder.createFolder(path) folder = cmisclient.defaultRepository.rootFolder.createFolder(path)
yield folder.properties['cmis:path'] yield folder.properties['cmis:path']
preserve_tree = request.config.getoption("--preserve-tree") preserve_tree = request.config.getoption('--preserve-tree')
if not preserve_tree: if not preserve_tree:
folder.deleteTree() folder.deleteTree()

View File

@ -10,7 +10,7 @@ SPECIAL_CHARS = '!#$%&+-^_`;[]{}+='
@pytest.mark.parametrize( @pytest.mark.parametrize(
"path,file_name", 'path,file_name',
[ [
('', 'some.file'), ('', 'some.file'),
('/toto', 'some.file'), ('/toto', 'some.file'),
@ -31,8 +31,8 @@ def test_uploadfile(cmisclient, cmis_connector, cmis_tmpdir, tmpdir, monkeypatch
response = requests.post( response = requests.post(
url, url,
json={ json={
"path": cmis_tmpdir + path, 'path': cmis_tmpdir + path,
"file": {"content": file_b64_content, "filename": file_name, "content_type": "image/jpeg"}, 'file': {'content': file_b64_content, 'filename': file_name, 'content_type': 'image/jpeg'},
}, },
) )
assert response.status_code == 200 assert response.status_code == 200
@ -59,8 +59,8 @@ def test_uploadfile_conflict(cmisclient, cmis_connector, cmis_tmpdir, tmpdir, mo
response = requests.post( response = requests.post(
url, url,
json={ json={
"path": cmis_tmpdir + '/uploadconflict', 'path': cmis_tmpdir + '/uploadconflict',
"file": {"content": file_b64_content, "filename": 'some.file', "content_type": "image/jpeg"}, 'file': {'content': file_b64_content, 'filename': 'some.file', 'content_type': 'image/jpeg'},
}, },
) )
assert response.status_code == 200 assert response.status_code == 200
@ -70,11 +70,11 @@ def test_uploadfile_conflict(cmisclient, cmis_connector, cmis_tmpdir, tmpdir, mo
response = requests.post( response = requests.post(
url, url,
json={ json={
"path": cmis_tmpdir + '/uploadconflict', 'path': cmis_tmpdir + '/uploadconflict',
"file": {"content": file_b64_content, "filename": 'some.file', "content_type": "image/jpeg"}, 'file': {'content': file_b64_content, 'filename': 'some.file', 'content_type': 'image/jpeg'},
}, },
) )
assert response.status_code == 200 assert response.status_code == 200
resp_data = response.json() resp_data = response.json()
assert resp_data['err'] == 1 assert resp_data['err'] == 1
assert resp_data['err_desc'].startswith("update conflict") assert resp_data['err_desc'].startswith('update conflict')

View File

@ -2,9 +2,9 @@ import pytest
def pytest_addoption(parser): def pytest_addoption(parser):
parser.addoption("--url", help="Url of a passerelle Planitech connector instance") parser.addoption('--url', help='Url of a passerelle Planitech connector instance')
@pytest.fixture(scope='session') @pytest.fixture(scope='session')
def conn(request): def conn(request):
return request.config.getoption("--url") return request.config.getoption('--url')

View File

@ -113,7 +113,7 @@ def test_main(conn):
def call_generic(conn, endpoint): def call_generic(conn, endpoint):
print("%s \n" % endpoint) print('%s \n' % endpoint)
url = conn + '/%s' % endpoint url = conn + '/%s' % endpoint
resp = requests.get(url) resp = requests.get(url)
resp.raise_for_status() resp.raise_for_status()

View File

@ -2,25 +2,25 @@ import pytest
def pytest_addoption(parser): def pytest_addoption(parser):
parser.addoption("--url", help="Url of a passerelle Toulouse Axel connector instance") parser.addoption('--url', help='Url of a passerelle Toulouse Axel connector instance')
parser.addoption("--nameid", help="Publik Name ID") parser.addoption('--nameid', help='Publik Name ID')
parser.addoption("--firstname", help="first name of a user") parser.addoption('--firstname', help='first name of a user')
parser.addoption("--lastname", help="Last name of a user") parser.addoption('--lastname', help='Last name of a user')
parser.addoption("--dob", help="Date of birth of a user") parser.addoption('--dob', help='Date of birth of a user')
parser.addoption("--dui", help="DUI number") parser.addoption('--dui', help='DUI number')
@pytest.fixture(scope='session') @pytest.fixture(scope='session')
def conn(request): def conn(request):
return request.config.getoption("--url") return request.config.getoption('--url')
@pytest.fixture(scope='session') @pytest.fixture(scope='session')
def user(request): def user(request):
return { return {
'name_id': request.config.getoption("--nameid"), 'name_id': request.config.getoption('--nameid'),
'first_name': request.config.getoption("--firstname"), 'first_name': request.config.getoption('--firstname'),
'last_name': request.config.getoption("--lastname"), 'last_name': request.config.getoption('--lastname'),
'dob': request.config.getoption("--dob"), 'dob': request.config.getoption('--dob'),
'dui': request.config.getoption("--dui"), 'dui': request.config.getoption('--dui'),
} }

View File

@ -4,7 +4,7 @@ import requests
def test_link(conn, user): def test_link(conn, user):
print("Get update management dates") print('Get update management dates')
url = conn + '/management_dates' url = conn + '/management_dates'
resp = requests.get(url) resp = requests.get(url)
resp.raise_for_status() resp.raise_for_status()
@ -21,7 +21,7 @@ def test_link(conn, user):
'PRENOM': user['first_name'], 'PRENOM': user['first_name'],
'NAISSANCE': user['dob'], 'NAISSANCE': user['dob'],
} }
print("Creating link with the following payload:") print('Creating link with the following payload:')
pprint.pprint(payload) pprint.pprint(payload)
resp = requests.post(url, json=payload) resp = requests.post(url, json=payload)
resp.raise_for_status() resp.raise_for_status()
@ -30,7 +30,7 @@ def test_link(conn, user):
pprint.pprint(res) pprint.pprint(res)
print('\n') print('\n')
print("GET family info") print('GET family info')
url = conn + '/family_info?NameID=%s' % name_id url = conn + '/family_info?NameID=%s' % name_id
resp = requests.get(url) resp = requests.get(url)
resp.raise_for_status() resp.raise_for_status()
@ -158,7 +158,7 @@ def test_link(conn, user):
for key in flags: for key in flags:
payload[key] = True payload[key] = True
print("Update family info with the following payload:") print('Update family info with the following payload:')
pprint.pprint(payload) pprint.pprint(payload)
url = conn + '/update_family_info?NameID=%s' % name_id url = conn + '/update_family_info?NameID=%s' % name_id
resp = requests.post(url, json=payload) resp = requests.post(url, json=payload)
@ -168,7 +168,7 @@ def test_link(conn, user):
pprint.pprint(res) pprint.pprint(res)
print('\n') print('\n')
print("GET children info") print('GET children info')
url = conn + '/children_info?NameID=%s' % (name_id) url = conn + '/children_info?NameID=%s' % (name_id)
resp = requests.get(url) resp = requests.get(url)
resp.raise_for_status() resp.raise_for_status()
@ -178,7 +178,7 @@ def test_link(conn, user):
print('\n') print('\n')
for child in data['data']['ENFANT']: for child in data['data']['ENFANT']:
print("GET child info") print('GET child info')
url = conn + '/child_info?NameID=%s&idpersonne=%s' % (name_id, child['IDPERSONNE']) url = conn + '/child_info?NameID=%s&idpersonne=%s' % (name_id, child['IDPERSONNE'])
resp = requests.get(url) resp = requests.get(url)
resp.raise_for_status() resp.raise_for_status()
@ -187,7 +187,7 @@ def test_link(conn, user):
pprint.pprint(res) pprint.pprint(res)
print('\n') print('\n')
print("GET child contact info") print('GET child contact info')
url = conn + '/child_contacts_info?NameID=%s&idpersonne=%s' % (name_id, child['IDPERSONNE']) url = conn + '/child_contacts_info?NameID=%s&idpersonne=%s' % (name_id, child['IDPERSONNE'])
resp = requests.get(url) resp = requests.get(url)
resp.raise_for_status() resp.raise_for_status()
@ -196,7 +196,7 @@ def test_link(conn, user):
pprint.pprint(res) pprint.pprint(res)
print('\n') print('\n')
print("Deleting link") print('Deleting link')
url = conn + '/unlink?NameID=%s' % name_id url = conn + '/unlink?NameID=%s' % name_id
resp = requests.post(url) resp = requests.post(url)
resp.raise_for_status() resp.raise_for_status()

View File

@ -5,7 +5,7 @@ from .conftest import diff
@pytest.mark.parametrize( @pytest.mark.parametrize(
"ref", 'ref',
[ [
'ape-indicators', 'ape-indicators',
'category', 'category',

View File

@ -36,7 +36,7 @@ def test_link(conn, update_data):
res = resp.json() res = resp.json()
assert res['err'] == 1 assert res['err'] == 1
assert res['err_class'] == 'passerelle.utils.soap.SOAPFault' assert res['err_class'] == 'passerelle.utils.soap.SOAPFault'
assert "E02 : Le dossier numéro [999999] ne correspond à aucune famille" in res['err_desc'] assert 'E02 : Le dossier numéro [999999] ne correspond à aucune famille' in res['err_desc']
# wrong DUI firstname # wrong DUI firstname
payload = { payload = {

View File

@ -309,7 +309,7 @@ def test_create_rl2(conn, create_data, update_data):
assert diff_rlg(conn, create_data['name_id'], 2, 'test_create_rl2.json') assert diff_rlg(conn, create_data['name_id'], 2, 'test_create_rl2.json')
@pytest.mark.parametrize("rl", ['1', '2']) @pytest.mark.parametrize('rl', ['1', '2'])
def test_update_rlg(conn, update_data, rl): def test_update_rlg(conn, update_data, rl):
rlg = 'rl' + rl rlg = 'rl' + rl
RLG = 'RL' + rl RLG = 'RL' + rl
@ -370,7 +370,7 @@ def test_update_rlg(conn, update_data, rl):
in res['err_desc'] in res['err_desc']
) )
else: else:
assert "La date de naissance ne peut pas être modifiée" in res['err_desc'] assert 'La date de naissance ne peut pas être modifiée' in res['err_desc']
# restore RL1 # restore RL1
payload = copy.deepcopy(update_data['family_payload'][rlg]) payload = copy.deepcopy(update_data['family_payload'][rlg])

View File

@ -48,7 +48,7 @@ def test_perisco_agenda(conn, create_data, perisco_subscribe_info):
if booking['disabled'] is False: if booking['disabled'] is False:
break break
else: else:
raise Exception("no booking available") raise Exception('no booking available')
assert booking['details']['activity_id'] == perisco_subscribe_info['activity']['id'] assert booking['details']['activity_id'] == perisco_subscribe_info['activity']['id']
assert booking['details']['activity_label'] == 'Temps du midi' assert booking['details']['activity_label'] == 'Temps du midi'
assert booking['prefill'] is False assert booking['prefill'] is False
@ -124,7 +124,7 @@ def test_perisco_agenda_adulte(conn, create_data2, perisco_subscribe_adulte_info
if booking['disabled'] is False: if booking['disabled'] is False:
break break
else: else:
raise Exception("no booking available") raise Exception('no booking available')
assert booking['details']['activity_id'] == perisco_subscribe_adulte_info['activity']['id'] assert booking['details']['activity_id'] == perisco_subscribe_adulte_info['activity']['id']
assert booking['details']['activity_label'] == 'RESTAURATION ADULTE' assert booking['details']['activity_label'] == 'RESTAURATION ADULTE'
assert booking['prefill'] is False assert booking['prefill'] is False

View File

@ -2,9 +2,9 @@ import pytest
def pytest_addoption(parser): def pytest_addoption(parser):
parser.addoption("--url", help="Url of a passerelle Vivaticket connector instance") parser.addoption('--url', help='Url of a passerelle Vivaticket connector instance')
@pytest.fixture(scope='session') @pytest.fixture(scope='session')
def conn(request): def conn(request):
return request.config.getoption("--url") return request.config.getoption('--url')

View File

@ -6,7 +6,7 @@ import requests
def call_generic(conn, endpoint): def call_generic(conn, endpoint):
print("%s \n" % endpoint) print('%s \n' % endpoint)
url = conn + '/%s' % endpoint url = conn + '/%s' % endpoint
resp = requests.get(url) resp = requests.get(url)
resp.raise_for_status() resp.raise_for_status()
@ -50,7 +50,7 @@ def test_book_event(conn):
themes = call_generic(conn, 'themes') themes = call_generic(conn, 'themes')
random.shuffle(themes) random.shuffle(themes)
payload['theme'] = themes[0]['id'] payload['theme'] = themes[0]['id']
print("Creating booking with the following payload:\n%s" % payload) print('Creating booking with the following payload:\n%s' % payload)
resp = requests.post(url, json=payload) resp = requests.post(url, json=payload)
resp.raise_for_status() resp.raise_for_status()
res = resp.json() res = resp.json()

View File

@ -2,8 +2,8 @@
import os import os
import sys import sys
if __name__ == "__main__": if __name__ == '__main__':
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "passerelle.settings") os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'passerelle.settings')
from django.core.management import execute_from_command_line from django.core.management import execute_from_command_line

View File

@ -176,7 +176,7 @@ class AdullactPastell(BaseResource, HTTPResource):
'description': _('Create a document for an entity'), 'description': _('Create a document for an entity'),
'request_body': {'schema': {'application/json': DOCUMENT_CREATION_SCHEMA}}, 'request_body': {'schema': {'application/json': DOCUMENT_CREATION_SCHEMA}},
}, },
name="create-document", name='create-document',
parameters={ parameters={
'entity_id': {'description': _('Entity ID'), 'example_value': '42'}, 'entity_id': {'description': _('Entity ID'), 'example_value': '42'},
}, },
@ -203,7 +203,7 @@ class AdullactPastell(BaseResource, HTTPResource):
'description': _('Upload a file to a document'), 'description': _('Upload a file to a document'),
'request_body': {'schema': {'application/json': DOCUMENT_FILE_UPLOAD_SCHEMA}}, 'request_body': {'schema': {'application/json': DOCUMENT_FILE_UPLOAD_SCHEMA}},
}, },
name="upload-document-file", name='upload-document-file',
parameters={ parameters={
'entity_id': {'description': _('Entity ID'), 'example_value': '42'}, 'entity_id': {'description': _('Entity ID'), 'example_value': '42'},
'document_id': {'description': _('Document ID'), 'example_value': 'hDWtdSC'}, 'document_id': {'description': _('Document ID'), 'example_value': 'hDWtdSC'},
@ -217,7 +217,7 @@ class AdullactPastell(BaseResource, HTTPResource):
@endpoint( @endpoint(
description=_('Get document\'s file'), description=_('Get document\'s file'),
name="get-document-file", name='get-document-file',
parameters={ parameters={
'entity_id': {'description': _('Entity ID'), 'example_value': '42'}, 'entity_id': {'description': _('Entity ID'), 'example_value': '42'},
'document_id': {'description': _('Document ID'), 'example_value': 'hDWtdSC'}, 'document_id': {'description': _('Document ID'), 'example_value': 'hDWtdSC'},

View File

@ -42,7 +42,7 @@ KNOWN_ERRORS = {
"Votre demande n'a pu aboutir en raison d'un incident technique lié à l'appel au service IMC. Des paramètres manquent.", "Votre demande n'a pu aboutir en raison d'un incident technique lié à l'appel au service IMC. Des paramètres manquent.",
( (
"Votre demande n'a pu aboutir en raison d'un incident technique lié à l'appel au service IMC. " "Votre demande n'a pu aboutir en raison d'un incident technique lié à l'appel au service IMC. "
"La taille du message ne doit pas être supérieure à 160 caractères." 'La taille du message ne doit pas être supérieure à 160 caractères.'
), ),
( (
"Votre demande n'a pu aboutir en raison d'un incident technique lié à l'appel au service IMC. " "Votre demande n'a pu aboutir en raison d'un incident technique lié à l'appel au service IMC. "
@ -53,7 +53,7 @@ KNOWN_ERRORS = {
"Votre demande n'a pu aboutir en raison d'une erreur technique lié à l'appel au service IMC.", "Votre demande n'a pu aboutir en raison d'une erreur technique lié à l'appel au service IMC.",
( (
"Votre demande na pu aboutir en raison d'un problème technique lié aux données entrantes du webservice. " "Votre demande na pu aboutir en raison d'un problème technique lié aux données entrantes du webservice. "
"Merci de renouveler votre demande ultérieurement." 'Merci de renouveler votre demande ultérieurement.'
), ),
}, },
} }

View File

@ -102,7 +102,7 @@ class ArpegeECP(BaseResource):
except ValueError: except ValueError:
raise APIError('No JSON content returned: %r' % response.content[:1000]) raise APIError('No JSON content returned: %r' % response.content[:1000])
if not result.get('Data'): if not result.get('Data'):
raise APIError("%s (%s)" % (result.get('LibErreur'), result.get('CodErreur'))) raise APIError('%s (%s)' % (result.get('LibErreur'), result.get('CodErreur')))
for demand in result['Data']['results']: for demand in result['Data']['results']:
try: try:
data_administratives = demand['data_administratives'] data_administratives = demand['data_administratives']

View File

@ -240,7 +240,7 @@ class ASTech(BaseResource, HTTPResource):
@endpoint( @endpoint(
name='services', name='services',
description=_("List authorized services for connected user"), description=_('List authorized services for connected user'),
display_category=_('Rules'), display_category=_('Rules'),
display_order=1, display_order=1,
) )
@ -331,7 +331,7 @@ class ASTech(BaseResource, HTTPResource):
@endpoint( @endpoint(
name='parameter', name='parameter',
description=_("Value of a parameter"), description=_('Value of a parameter'),
parameters={ parameters={
'name': {'description': _('Name of the parameter'), 'example_value': 'LIBELDEMDEF'}, 'name': {'description': _('Name of the parameter'), 'example_value': 'LIBELDEMDEF'},
'company': {'description': _('Company code. If absent, use "company" endpoint result')}, 'company': {'description': _('Company code. If absent, use "company" endpoint result')},

View File

@ -28,164 +28,164 @@ from passerelle.utils.jsonresponse import APIError
from passerelle.utils.validation import is_number from passerelle.utils.validation import is_number
ASSOCIATION_SCHEMA = { ASSOCIATION_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#", '$schema': 'http://json-schema.org/draft-04/schema#',
"title": "AstreGS assocation", 'title': 'AstreGS assocation',
"description": "", 'description': '',
"type": "object", 'type': 'object',
"required": [ 'required': [
"Financier", 'Financier',
"CodeFamille", 'CodeFamille',
"CatTiers", 'CatTiers',
"NomEnregistrement", 'NomEnregistrement',
"StatutTiers", 'StatutTiers',
"Type", 'Type',
"AdresseTitre", 'AdresseTitre',
"AdresseIsAdresseDeCommande", 'AdresseIsAdresseDeCommande',
"AdresseIsAdresseDeFacturation", 'AdresseIsAdresseDeFacturation',
], ],
"properties": { 'properties': {
"Financier": {"description": "financial association", "type": "string", "enum": ["true", "false"]}, 'Financier': {'description': 'financial association', 'type': 'string', 'enum': ['true', 'false']},
"CodeFamille": { 'CodeFamille': {
"description": "association family code", 'description': 'association family code',
"type": "string", 'type': 'string',
}, },
"CatTiers": { 'CatTiers': {
"description": "association category", 'description': 'association category',
"type": "string", 'type': 'string',
}, },
"NomEnregistrement": { 'NomEnregistrement': {
"description": "association name", 'description': 'association name',
"type": "string", 'type': 'string',
}, },
"StatutTiers": { 'StatutTiers': {
"description": "association status", 'description': 'association status',
"type": "string", 'type': 'string',
"enum": ["PROPOSE", "VALIDE", "REFUSE", "BLOQUE", "A COMPLETER"], 'enum': ['PROPOSE', 'VALIDE', 'REFUSE', 'BLOQUE', 'A COMPLETER'],
}, },
"Type": {"description": "association type", "type": "string", "enum": ["D", "F", "*"]}, 'Type': {'description': 'association type', 'type': 'string', 'enum': ['D', 'F', '*']},
"NumeroSiret": { 'NumeroSiret': {
"description": "SIREN number", 'description': 'SIREN number',
"type": "string", 'type': 'string',
}, },
"NumeroSiretFin": { 'NumeroSiretFin': {
"description": "NIC number", 'description': 'NIC number',
"type": "string", 'type': 'string',
}, },
"AdresseTitre": { 'AdresseTitre': {
"type": "string", 'type': 'string',
}, },
"AdresseIsAdresseDeCommande": {"type": "string", "enum": ["true", "false"]}, 'AdresseIsAdresseDeCommande': {'type': 'string', 'enum': ['true', 'false']},
"AdresseIsAdresseDeFacturation": {"type": "string", "enum": ["true", "false"]}, 'AdresseIsAdresseDeFacturation': {'type': 'string', 'enum': ['true', 'false']},
"organism": { 'organism': {
"description": _('Organisme'), 'description': _('Organisme'),
"type": "string", 'type': 'string',
}, },
"budget": { 'budget': {
"description": _('Budget'), 'description': _('Budget'),
"type": "string", 'type': 'string',
}, },
"exercice": { 'exercice': {
"description": _('Exercice'), 'description': _('Exercice'),
"type": "string", 'type': 'string',
}, },
}, },
} }
CONTACT_SCHEMA = { CONTACT_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#", '$schema': 'http://json-schema.org/draft-04/schema#',
"title": "AstreGS contact", 'title': 'AstreGS contact',
"description": "", 'description': '',
"type": "object", 'type': 'object',
"required": [ 'required': [
"CodeContact", 'CodeContact',
"CodeTitreCivilite", 'CodeTitreCivilite',
"Nom", 'Nom',
"AdresseDestinataire", 'AdresseDestinataire',
"CodePostal", 'CodePostal',
"Ville", 'Ville',
"EncodeKeyStatut", 'EncodeKeyStatut',
], ],
"properties": { 'properties': {
"CodeContact": { 'CodeContact': {
"type": "string", 'type': 'string',
}, },
"CodeTitreCivilite": { 'CodeTitreCivilite': {
"type": "string", 'type': 'string',
}, },
"Nom": { 'Nom': {
"type": "string", 'type': 'string',
}, },
"AdresseDestinataire": { 'AdresseDestinataire': {
"type": "string", 'type': 'string',
}, },
"CodePostal": { 'CodePostal': {
"type": "string", 'type': 'string',
}, },
"Ville": { 'Ville': {
"type": "string", 'type': 'string',
}, },
"EncodeKeyStatut": { 'EncodeKeyStatut': {
"type": "string", 'type': 'string',
}, },
"organism": { 'organism': {
"description": _('Organisme'), 'description': _('Organisme'),
"type": "string", 'type': 'string',
}, },
"budget": { 'budget': {
"description": _('Budget'), 'description': _('Budget'),
"type": "string", 'type': 'string',
}, },
"exercice": { 'exercice': {
"description": _('Exercice'), 'description': _('Exercice'),
"type": "string", 'type': 'string',
}, },
}, },
} }
DOCUMENT_SCHEMA = { DOCUMENT_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#", '$schema': 'http://json-schema.org/draft-04/schema#',
"title": "AstreGS assocation", 'title': 'AstreGS assocation',
"description": "", 'description': '',
"type": "object", 'type': 'object',
"required": [ 'required': [
"Sujet", 'Sujet',
"Entite", 'Entite',
"CodType", 'CodType',
"Type", 'Type',
"hdnCodeTrt", 'hdnCodeTrt',
"EncodeKeyEntite", 'EncodeKeyEntite',
"CodeDomaine", 'CodeDomaine',
"CodDom", 'CodDom',
"document", 'document',
], ],
"properties": { 'properties': {
"Sujet": { 'Sujet': {
"type": "string", 'type': 'string',
}, },
"Entite": { 'Entite': {
"type": "string", 'type': 'string',
}, },
"CodType": { 'CodType': {
"type": "string", 'type': 'string',
}, },
"Type": { 'Type': {
"type": "string", 'type': 'string',
}, },
"hdnCodeTrt": { 'hdnCodeTrt': {
"type": "string", 'type': 'string',
}, },
"EncodeKeyEntite": { 'EncodeKeyEntite': {
"type": "string", 'type': 'string',
}, },
"CodeDomaine": { 'CodeDomaine': {
"type": "string", 'type': 'string',
}, },
"CodDom": { 'CodDom': {
"type": "string", 'type': 'string',
}, },
"document": { 'document': {
"type": "object", 'type': 'object',
"required": ['filename', 'content_type', 'content'], 'required': ['filename', 'content_type', 'content'],
'properties': { 'properties': {
'filename': { 'filename': {
'type': 'string', 'type': 'string',
@ -198,236 +198,236 @@ DOCUMENT_SCHEMA = {
}, },
}, },
}, },
"organism": { 'organism': {
"description": _('Organisme'), 'description': _('Organisme'),
"type": "string", 'type': 'string',
}, },
"budget": { 'budget': {
"description": _('Budget'), 'description': _('Budget'),
"type": "string", 'type': 'string',
}, },
"exercice": { 'exercice': {
"description": _('Exercice'), 'description': _('Exercice'),
"type": "string", 'type': 'string',
}, },
}, },
} }
GRANT_SCHEMA = { GRANT_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#", '$schema': 'http://json-schema.org/draft-04/schema#',
"title": "AstreGS grant", 'title': 'AstreGS grant',
"description": "", 'description': '',
"type": "object", 'type': 'object',
"required": [ 'required': [
"Libelle", 'Libelle',
"LibelleCourt", 'LibelleCourt',
"ModGestion", 'ModGestion',
"TypeAide", 'TypeAide',
"Sens", 'Sens',
"CodeTiersDem", 'CodeTiersDem',
"CodeServiceGestionnaire", 'CodeServiceGestionnaire',
"CodeServiceUtilisateur", 'CodeServiceUtilisateur',
], ],
"properties": { 'properties': {
"Libelle": { 'Libelle': {
"type": "string", 'type': 'string',
}, },
"LibelleCourt": { 'LibelleCourt': {
"type": "string", 'type': 'string',
}, },
"ModGestion": {"type": "string", "enum": ["1", "2", "3", "4"]}, 'ModGestion': {'type': 'string', 'enum': ['1', '2', '3', '4']},
"TypeAide": { 'TypeAide': {
"type": "string", 'type': 'string',
}, },
"Sens": { 'Sens': {
"type": "string", 'type': 'string',
}, },
"CodeTiersDem": { 'CodeTiersDem': {
"type": "string", 'type': 'string',
}, },
"CodeServiceGestionnaire": { 'CodeServiceGestionnaire': {
"type": "string", 'type': 'string',
}, },
"CodeServiceUtilisateur": { 'CodeServiceUtilisateur': {
"type": "string", 'type': 'string',
}, },
"organism": { 'organism': {
"description": _('Organisme'), 'description': _('Organisme'),
"type": "string", 'type': 'string',
}, },
"budget": { 'budget': {
"description": _('Budget'), 'description': _('Budget'),
"type": "string", 'type': 'string',
}, },
"exercice": { 'exercice': {
"description": _('Exercice'), 'description': _('Exercice'),
"type": "string", 'type': 'string',
}, },
}, },
} }
INDANA_SCHEMA = { INDANA_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#", '$schema': 'http://json-schema.org/draft-04/schema#',
"title": "AstreGS INDANA indicator", 'title': 'AstreGS INDANA indicator',
"description": "", 'description': '',
"type": "object", 'type': 'object',
"required": ["CodeDossier", "CodeInd_1", "AnneeInd_1", "ValInd_1"], 'required': ['CodeDossier', 'CodeInd_1', 'AnneeInd_1', 'ValInd_1'],
"properties": { 'properties': {
"CodeDossier": { 'CodeDossier': {
"type": "string", 'type': 'string',
}, },
"CodeInd_1": { 'CodeInd_1': {
"type": "string", 'type': 'string',
}, },
"AnneeInd_1": { 'AnneeInd_1': {
"type": "string", 'type': 'string',
}, },
"ValInd_1": { 'ValInd_1': {
"type": "string", 'type': 'string',
}, },
"IndAide": { 'IndAide': {
"type": "string", 'type': 'string',
}, },
"organism": { 'organism': {
"description": _('Organisme'), 'description': _('Organisme'),
"type": "string", 'type': 'string',
}, },
"budget": { 'budget': {
"description": _('Budget'), 'description': _('Budget'),
"type": "string", 'type': 'string',
}, },
"exercice": { 'exercice': {
"description": _('Exercice'), 'description': _('Exercice'),
"type": "string", 'type': 'string',
}, },
}, },
} }
INDANA_KEY_SCHEMA = { INDANA_KEY_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#", '$schema': 'http://json-schema.org/draft-04/schema#',
"title": "AstreGS INDANA indicator key", 'title': 'AstreGS INDANA indicator key',
"description": "", 'description': '',
"type": "object", 'type': 'object',
"required": ["CodeDossier", "CodeInd_1", "AnneeInd_1"], 'required': ['CodeDossier', 'CodeInd_1', 'AnneeInd_1'],
"properties": { 'properties': {
"CodeDossier": { 'CodeDossier': {
"type": "string", 'type': 'string',
}, },
"CodeInd_1": { 'CodeInd_1': {
"type": "string", 'type': 'string',
}, },
"AnneeInd_1": { 'AnneeInd_1': {
"type": "string", 'type': 'string',
}, },
"organism": { 'organism': {
"description": _('Organisme'), 'description': _('Organisme'),
"type": "string", 'type': 'string',
}, },
"budget": { 'budget': {
"description": _('Budget'), 'description': _('Budget'),
"type": "string", 'type': 'string',
}, },
"exercice": { 'exercice': {
"description": _('Exercice'), 'description': _('Exercice'),
"type": "string", 'type': 'string',
}, },
}, },
} }
TIERS_RIB_SCHEMA = { TIERS_RIB_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#", '$schema': 'http://json-schema.org/draft-04/schema#',
"title": "AstreGS TiersRib", 'title': 'AstreGS TiersRib',
"description": "TiersRib", 'description': 'TiersRib',
"type": "object", 'type': 'object',
"required": [ 'required': [
"CodeTiers", 'CodeTiers',
"CodePaiement", 'CodePaiement',
"LibelleCourt", 'LibelleCourt',
"NumeroIban", 'NumeroIban',
"CleIban", 'CleIban',
'CodeBic', 'CodeBic',
"CodeDomiciliation", 'CodeDomiciliation',
"CodeStatut", 'CodeStatut',
"CodeDevise", 'CodeDevise',
"CodeIso2Pays", 'CodeIso2Pays',
"LibelleCompteEtranger", 'LibelleCompteEtranger',
], ],
"properties": { 'properties': {
"CodeDevise": {"type": "string"}, 'CodeDevise': {'type': 'string'},
"CodeDomiciliation": {"type": "string"}, 'CodeDomiciliation': {'type': 'string'},
"CodeIso2Pays": {"type": "string"}, 'CodeIso2Pays': {'type': 'string'},
"CodePaiement": {"type": "string"}, 'CodePaiement': {'type': 'string'},
"CodeStatut": { 'CodeStatut': {
"type": "string", 'type': 'string',
"enum": ["PROPOSE", "VALIDE", "REFUSE", "A COMPLETER", "BLOQUE", "EN MODIFICATION"], 'enum': ['PROPOSE', 'VALIDE', 'REFUSE', 'A COMPLETER', 'BLOQUE', 'EN MODIFICATION'],
}, },
"CodeTiers": {"type": "string"}, 'CodeTiers': {'type': 'string'},
"IndicateurRibDefaut": {"type": "string"}, 'IndicateurRibDefaut': {'type': 'string'},
"LibelleCompteEtranger": {"type": "string"}, 'LibelleCompteEtranger': {'type': 'string'},
"LibelleCourt": {"type": "string"}, 'LibelleCourt': {'type': 'string'},
"NumeroIban": {"type": "string"}, 'NumeroIban': {'type': 'string'},
"CleIban": {"type": "string"}, 'CleIban': {'type': 'string'},
"CodeBic": {"type": "string"}, 'CodeBic': {'type': 'string'},
"IdRib": {"type": "string"}, 'IdRib': {'type': 'string'},
"organism": { 'organism': {
"description": _('Organisme'), 'description': _('Organisme'),
"type": "string", 'type': 'string',
}, },
"budget": { 'budget': {
"description": _('Budget'), 'description': _('Budget'),
"type": "string", 'type': 'string',
}, },
"exercice": { 'exercice': {
"description": _('Exercice'), 'description': _('Exercice'),
"type": "string", 'type': 'string',
}, },
}, },
} }
TIERS_RIB_UPDATE_SCHEMA = { TIERS_RIB_UPDATE_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#", '$schema': 'http://json-schema.org/draft-04/schema#',
"title": "AstreGS TiersRib", 'title': 'AstreGS TiersRib',
"description": "TiersRib Update", 'description': 'TiersRib Update',
"type": "object", 'type': 'object',
"required": [ 'required': [
"CodePaiement", 'CodePaiement',
"LibelleCourt", 'LibelleCourt',
"NumeroIban", 'NumeroIban',
"CleIban", 'CleIban',
"CodeBic", 'CodeBic',
"CodeDomiciliation", 'CodeDomiciliation',
"CodeStatut", 'CodeStatut',
"CodeDevise", 'CodeDevise',
"CodeIso2Pays", 'CodeIso2Pays',
"LibelleCompteEtranger", 'LibelleCompteEtranger',
], ],
"properties": { 'properties': {
"CodeDevise": {"type": "string"}, 'CodeDevise': {'type': 'string'},
"CodeDomiciliation": {"type": "string"}, 'CodeDomiciliation': {'type': 'string'},
"CodeIso2Pays": {"type": "string"}, 'CodeIso2Pays': {'type': 'string'},
"CodePaiement": {"type": "string"}, 'CodePaiement': {'type': 'string'},
"CodeStatut": { 'CodeStatut': {
"type": "string", 'type': 'string',
"enum": ["PROPOSE", "VALIDE", "REFUSE", "A COMPLETER", "BLOQUE", "EN MODIFICATION"], 'enum': ['PROPOSE', 'VALIDE', 'REFUSE', 'A COMPLETER', 'BLOQUE', 'EN MODIFICATION'],
}, },
"IndicateurRibDefaut": {"type": "string"}, 'IndicateurRibDefaut': {'type': 'string'},
"LibelleCompteEtranger": {"type": "string"}, 'LibelleCompteEtranger': {'type': 'string'},
"LibelleCourt": {"type": "string"}, 'LibelleCourt': {'type': 'string'},
"NumeroIban": {"type": "string"}, 'NumeroIban': {'type': 'string'},
"CleIban": {"type": "string"}, 'CleIban': {'type': 'string'},
"CodeBic": {"type": "string"}, 'CodeBic': {'type': 'string'},
"organism": { 'organism': {
"description": _('Organisme'), 'description': _('Organisme'),
"type": "string", 'type': 'string',
}, },
"budget": { 'budget': {
"description": _('Budget'), 'description': _('Budget'),
"type": "string", 'type': 'string',
}, },
"exercice": { 'exercice': {
"description": _('Exercice'), 'description': _('Exercice'),
"type": "string", 'type': 'string',
}, },
}, },
} }

View File

@ -6,19 +6,19 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
("base_adresse", "0018_text_to_jsonb"), ('base_adresse', '0018_text_to_jsonb'),
] ]
operations = [ operations = [
migrations.AddField( migrations.AddField(
model_name="streetmodel", model_name='streetmodel',
name="resource", name='resource',
field=models.ForeignKey( field=models.ForeignKey(
default=None, default=None,
null=True, null=True,
on_delete=django.db.models.deletion.CASCADE, on_delete=django.db.models.deletion.CASCADE,
to="base_adresse.BaseAdresse", to='base_adresse.BaseAdresse',
verbose_name="BAN Connector", verbose_name='BAN Connector',
), ),
), ),
] ]

View File

@ -4,8 +4,8 @@ from django.db import migrations
def set_streetmodel_resource(apps, schema_editor): def set_streetmodel_resource(apps, schema_editor):
BaseAdresse = apps.get_model("base_adresse", "BaseAdresse") BaseAdresse = apps.get_model('base_adresse', 'BaseAdresse')
StreetModel = apps.get_model("base_adresse", "StreetModel") StreetModel = apps.get_model('base_adresse', 'StreetModel')
if BaseAdresse.objects.exists(): if BaseAdresse.objects.exists():
StreetModel.objects.update(resource=BaseAdresse.objects.first()) StreetModel.objects.update(resource=BaseAdresse.objects.first())
else: else:
@ -14,7 +14,7 @@ def set_streetmodel_resource(apps, schema_editor):
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
("base_adresse", "0019_streetmodel_resource_add"), ('base_adresse', '0019_streetmodel_resource_add'),
] ]
operations = [ operations = [

View File

@ -6,17 +6,17 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
("base_adresse", "0020_streetmodel_resource_runpython"), ('base_adresse', '0020_streetmodel_resource_runpython'),
] ]
operations = [ operations = [
migrations.AlterField( migrations.AlterField(
model_name="streetmodel", model_name='streetmodel',
name="resource", name='resource',
field=models.ForeignKey( field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, on_delete=django.db.models.deletion.CASCADE,
to="base_adresse.BaseAdresse", to='base_adresse.BaseAdresse',
verbose_name="BAN Connector", verbose_name='BAN Connector',
), ),
), ),
] ]

View File

@ -4,11 +4,11 @@ from django.db import migrations
def set_resource(apps, schema_editor): def set_resource(apps, schema_editor):
BaseAdresse = apps.get_model("base_adresse", "BaseAdresse") BaseAdresse = apps.get_model('base_adresse', 'BaseAdresse')
RegionModel = apps.get_model("base_adresse", "RegionModel") RegionModel = apps.get_model('base_adresse', 'RegionModel')
DepartmentModel = apps.get_model("base_adresse", "DepartmentModel") DepartmentModel = apps.get_model('base_adresse', 'DepartmentModel')
CityModel = apps.get_model("base_adresse", "CityModel") CityModel = apps.get_model('base_adresse', 'CityModel')
AddressCacheModel = apps.get_model("base_adresse", "AddressCacheModel") AddressCacheModel = apps.get_model('base_adresse', 'AddressCacheModel')
if BaseAdresse.objects.exists(): if BaseAdresse.objects.exists():
resource = BaseAdresse.objects.first() resource = BaseAdresse.objects.first()
RegionModel.objects.update(resource=resource) RegionModel.objects.update(resource=resource)

View File

@ -326,7 +326,7 @@ class BaseAdresse(AddressResource):
perm='OPEN', perm='OPEN',
parameters={ parameters={
'id': {'description': _('Street identifier')}, 'id': {'description': _('Street identifier')},
'q': {'description': _("Street name")}, 'q': {'description': _('Street name')},
'zipcode': {'description': _('Zipcode')}, 'zipcode': {'description': _('Zipcode')},
'citycode': {'description': _('INSEE City code')}, 'citycode': {'description': _('INSEE City code')},
'page_limit': {'description': _('Maximum number of results to return'), 'example_value': 30}, 'page_limit': {'description': _('Maximum number of results to return'), 'example_value': 30},
@ -383,7 +383,7 @@ class BaseAdresse(AddressResource):
'description': _('Get exactly one city using its code and postal code separated with a dot'), 'description': _('Get exactly one city using its code and postal code separated with a dot'),
'example_value': '75056.75014', 'example_value': '75056.75014',
}, },
'q': {'description': _("Search text in name or postal code"), 'example_value': 'Paris'}, 'q': {'description': _('Search text in name or postal code'), 'example_value': 'Paris'},
'code': { 'code': {
'description': _('INSEE code (or multiple codes separated with commas)'), 'description': _('INSEE code (or multiple codes separated with commas)'),
'example_value': '75056', 'example_value': '75056',

View File

@ -26,33 +26,33 @@ from passerelle.utils.files import atomic_write
from passerelle.utils.jsonresponse import APIError from passerelle.utils.jsonresponse import APIError
CERTIFICATE_TYPES = [ CERTIFICATE_TYPES = [
{"id": "NAI", "text": "Naissance"}, {'id': 'NAI', 'text': 'Naissance'},
{"id": "MAR", "text": "Mariage"}, {'id': 'MAR', 'text': 'Mariage'},
{"id": "REC", "text": "Reconnaissance"}, {'id': 'REC', 'text': 'Reconnaissance'},
{"id": "DEC", "text": "Décès"}, {'id': 'DEC', 'text': 'Décès'},
] ]
SEXES = [{"id": "M", "text": "Homme"}, {"id": "F", "text": "Femme"}, {"id": "NA", "text": "Autre"}] SEXES = [{'id': 'M', 'text': 'Homme'}, {'id': 'F', 'text': 'Femme'}, {'id': 'NA', 'text': 'Autre'}]
TITLES = [ TITLES = [
{"id": "M", "text": "Monsieur"}, {'id': 'M', 'text': 'Monsieur'},
{"id": "Mme", "text": "Madame"}, {'id': 'Mme', 'text': 'Madame'},
{"id": "Mlle", "text": "Mademoiselle"}, {'id': 'Mlle', 'text': 'Mademoiselle'},
] ]
DOCUMENT_TYPES = [ DOCUMENT_TYPES = [
{"id": "CPI", "text": "Copie intégrale"}, {'id': 'CPI', 'text': 'Copie intégrale'},
{"id": "EXTAF", "text": "Extrait avec filiation"}, {'id': 'EXTAF', 'text': 'Extrait avec filiation'},
{"id": "EXTSF", "text": "Extrait sans filiation"}, {'id': 'EXTSF', 'text': 'Extrait sans filiation'},
{"id": "EXTPL", "text": "Extrait plurilingue"}, {'id': 'EXTPL', 'text': 'Extrait plurilingue'},
] ]
CONCERNED = [{"id": "reconnu", "text": "Reconnu"}, {"id": "auteur", "text": "Auteur"}] CONCERNED = [{'id': 'reconnu', 'text': 'Reconnu'}, {'id': 'auteur', 'text': 'Auteur'}]
ORIGINS = [ ORIGINS = [
{"id": "internet", "text": "Internet"}, {'id': 'internet', 'text': 'Internet'},
{"id": "guichet", "text": "Guichet"}, {'id': 'guichet', 'text': 'Guichet'},
{"id": "courrier", "text": "Courrier"}, {'id': 'courrier', 'text': 'Courrier'},
] ]

View File

@ -129,10 +129,10 @@ class CmisConnector(BaseResource):
def uploadfile(self, request, post_data): def uploadfile(self, request, post_data):
error, error_msg, data = self._validate_inputs(post_data) error, error_msg, data = self._validate_inputs(post_data)
if error: if error:
self.logger.debug("received invalid data: %s" % error_msg) self.logger.debug('received invalid data: %s' % error_msg)
raise APIError(error_msg, http_status=400) raise APIError(error_msg, http_status=400)
filename = data.get('filename') or data['file']['filename'] filename = data.get('filename') or data['file']['filename']
self.logger.info("received file_name: '%s', file_path: '%s'", filename, data["path"]) self.logger.info("received file_name: '%s', file_path: '%s'", filename, data['path'])
with self.get_cmis_gateway() as cmis_gateway: with self.get_cmis_gateway() as cmis_gateway:
doc = cmis_gateway.create_doc( doc = cmis_gateway.create_doc(
filename, filename,
@ -226,15 +226,15 @@ def wrap_cmis_error(f):
return f(*args, **kwargs) return f(*args, **kwargs)
except (urllib2.URLError, httplib2.HttpLib2Error) as e: except (urllib2.URLError, httplib2.HttpLib2Error) as e:
# FIXME urllib2 still used for cmslib 0.5 compat # FIXME urllib2 still used for cmslib 0.5 compat
raise APIError("connection error: %s" % e) raise APIError('connection error: %s' % e)
except PermissionDeniedException as e: except PermissionDeniedException as e:
raise APIError("permission denied: %s" % e) raise APIError('permission denied: %s' % e)
except UpdateConflictException as e: except UpdateConflictException as e:
raise APIError("update conflict: %s" % e) raise APIError('update conflict: %s' % e)
except InvalidArgumentException as e: except InvalidArgumentException as e:
raise APIError("invalid property name: %s" % e) raise APIError('invalid property name: %s' % e)
except CmisException as e: except CmisException as e:
raise APIError("cmis binding error: %s" % e) raise APIError('cmis binding error: %s' % e)
return wrapper return wrapper
@ -256,7 +256,7 @@ class CMISGateway:
return res return res
except ObjectNotFoundException: except ObjectNotFoundException:
self._logger.debug("'%s' not found" % file_path) self._logger.debug("'%s' not found" % file_path)
basepath = "" basepath = ''
folder = self.repo.rootFolder folder = self.repo.rootFolder
for path_part in file_path.strip('/').split('/'): for path_part in file_path.strip('/').split('/'):
basepath += '/%s' % path_part basepath += '/%s' % path_part

View File

@ -37,19 +37,19 @@ from passerelle.utils.files import atomic_write
from passerelle.utils.jsonresponse import APIError from passerelle.utils.jsonresponse import APIError
FILE_SCHEMA = { FILE_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#", '$schema': 'http://json-schema.org/draft-04/schema#',
"title": "File to encrypt", 'title': 'File to encrypt',
"description": "", 'description': '',
"type": "object", 'type': 'object',
"required": ["file"], 'required': ['file'],
"properties": { 'properties': {
"file": { 'file': {
"type": "object", 'type': 'object',
"required": ["filename", "content_type", "content"], 'required': ['filename', 'content_type', 'content'],
"properties": { 'properties': {
"filename": {"type": "string"}, 'filename': {'type': 'string'},
"content_type": {"type": "string"}, 'content_type': {'type': 'string'},
"content": {"type": "string"}, 'content': {'type': 'string'},
}, },
} }
}, },

View File

@ -45,7 +45,7 @@ with ignore_loggers('lml', 'pyexcel_io'):
from pyexcel_ods import get_data as get_data_ods from pyexcel_ods import get_data as get_data_ods
from pyexcel_xls import get_data as get_data_xls from pyexcel_xls import get_data as get_data_xls
identifier_re = re.compile(r"^[^\d\W]\w*\Z", re.UNICODE) identifier_re = re.compile(r'^[^\d\W]\w*\Z', re.UNICODE)
code_cache = OrderedDict() code_cache = OrderedDict()
@ -460,14 +460,14 @@ class CsvDataSource(BaseResource):
if 'id' in request.GET and not model_filters_id: if 'id' in request.GET and not model_filters_id:
# always provide a ?id= filter. # always provide a ?id= filter.
filters = ["id == %r" % force_str(request.GET['id'])] filters = ['id == %r' % force_str(request.GET['id'])]
data = [row for new_row, row in stream_expressions(filters, data, kind='filters') if new_row[0]] data = [row for new_row, row in stream_expressions(filters, data, kind='filters') if new_row[0]]
# allow jsonp queries by select2 # allow jsonp queries by select2
# filtering is done there after projection because we need a projection named text for # filtering is done there after projection because we need a projection named text for
# retro-compatibility with previous use of the csvdatasource with select2 # retro-compatibility with previous use of the csvdatasource with select2
if 'q' in request.GET: if 'q' in request.GET:
filters = ["%s in normalize(text.lower())" % repr(normalize(request.GET['q'].lower()))] filters = ['%s in normalize(text.lower())' % repr(normalize(request.GET['q'].lower()))]
data = [row for new_row, row in stream_expressions(filters, data, kind='filters') if new_row[0]] data = [row for new_row, row in stream_expressions(filters, data, kind='filters') if new_row[0]]
# force rendition of iterator as list # force rendition of iterator as list

View File

@ -33,7 +33,7 @@ from passerelle.utils.jsonresponse import APIError
CREATE_APPOINTMENT_SCHEMA = { CREATE_APPOINTMENT_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#', '$schema': 'http://json-schema.org/draft-04/schema#',
"type": "object", 'type': 'object',
'properties': { 'properties': {
'idSys': {'type': 'string', 'pattern': '^[0-9]*$'}, 'idSys': {'type': 'string', 'pattern': '^[0-9]*$'},
'codeRDV': {'type': 'string'}, 'codeRDV': {'type': 'string'},
@ -52,7 +52,7 @@ CREATE_APPOINTMENT_SCHEMA = {
'properties': { 'properties': {
'idSys': {'type': 'string', 'pattern': '^[0-9]*$'}, 'idSys': {'type': 'string', 'pattern': '^[0-9]*$'},
'personalIdentity': {'type': 'string'}, 'personalIdentity': {'type': 'string'},
'additionalPersonalIdentity': {"type": "array", "items": {'type': 'string'}}, 'additionalPersonalIdentity': {'type': 'array', 'items': {'type': 'string'}},
'lastName': {'type': 'string'}, 'lastName': {'type': 'string'},
'civility': {'type': 'string'}, 'civility': {'type': 'string'},
'firstName': {'type': 'string'}, 'firstName': {'type': 'string'},
@ -74,7 +74,7 @@ CREATE_APPOINTMENT_SCHEMA = {
}, },
'serviceId': {'type': 'string'}, 'serviceId': {'type': 'string'},
'siteCode': {'type': 'string'}, 'siteCode': {'type': 'string'},
"resources": { 'resources': {
'type': 'object', 'type': 'object',
'properties': { 'properties': {
'id': {'type': 'string', 'pattern': '^[0-9]*$'}, 'id': {'type': 'string', 'pattern': '^[0-9]*$'},
@ -92,8 +92,8 @@ CREATE_APPOINTMENT_SCHEMA = {
}, },
}, },
'motives': { 'motives': {
"type": "array", 'type': 'array',
"items": { 'items': {
'type': 'object', 'type': 'object',
'properties': { 'properties': {
'id': {'type': 'string', 'pattern': '^[0-9]*$'}, 'id': {'type': 'string', 'pattern': '^[0-9]*$'},

View File

@ -146,7 +146,7 @@ class Filr(BaseResource, HTTPResource):
return {'data': data} return {'data': data}
@endpoint( @endpoint(
name="delete-folder", name='delete-folder',
methods=['post'], methods=['post'],
description=_('Delete a folder'), description=_('Delete a folder'),
post={'request_body': {'schema': {'application/json': schemas.DELETE_FOLDER}}}, post={'request_body': {'schema': {'application/json': schemas.DELETE_FOLDER}}},

View File

@ -32,156 +32,156 @@ FILES_ENCODING = 'latin-1'
APPLICANT_SCHEMA = OrderedDict( APPLICANT_SCHEMA = OrderedDict(
( (
( (
"form_id", 'form_id',
{ {
"type": "string", 'type': 'string',
}, },
), ),
( (
"demand_date", 'demand_date',
{ {
"type": "string", 'type': 'string',
"pattern": "^[0-9]{8}$", 'pattern': '^[0-9]{8}$',
}, },
), ),
( (
"demand_time", 'demand_time',
{ {
"type": "string", 'type': 'string',
"pattern": "^[0-9]{6}$", 'pattern': '^[0-9]{6}$',
}, },
), ),
( (
"producer_code", 'producer_code',
{ {
"type": "integer", 'type': 'integer',
}, },
), ),
("invariant_number", {"type": "string", "maxLength": 10, "default": ""}), ('invariant_number', {'type': 'string', 'maxLength': 10, 'default': ''}),
( (
"city_insee_code", 'city_insee_code',
{ {
"type": "string", 'type': 'string',
}, },
), ),
( (
"street_rivoli_code", 'street_rivoli_code',
{ {
"type": "string", 'type': 'string',
}, },
), ),
( (
"street_name", 'street_name',
{ {
"type": "string", 'type': 'string',
}, },
), ),
("address_complement", {"type": "string", "maxLength": 32, "default": ""}), ('address_complement', {'type': 'string', 'maxLength': 32, 'default': ''}),
("street_number", {"type": "integer", "default": 0}), ('street_number', {'type': 'integer', 'default': 0}),
("bis_ter", {"type": "string", "maxLength": 3, "default": ""}), ('bis_ter', {'type': 'string', 'maxLength': 3, 'default': ''}),
("building", {"type": "string", "maxLength": 5, "default": ""}), ('building', {'type': 'string', 'maxLength': 5, 'default': ''}),
("hall", {"type": "string", "maxLength": 5, "default": ""}), ('hall', {'type': 'string', 'maxLength': 5, 'default': ''}),
("appartment_number", {"type": "string", "maxLength": 5, "default": ""}), ('appartment_number', {'type': 'string', 'maxLength': 5, 'default': ''}),
("producer_social_reason", {"type": "string", "maxLength": 38, "default": ""}), ('producer_social_reason', {'type': 'string', 'maxLength': 38, 'default': ''}),
("producer_title_code", {"type": "integer", "default": 0}), ('producer_title_code', {'type': 'integer', 'default': 0}),
("producer_last_name", {"type": "string", "maxLength": 38, "default": ""}), ('producer_last_name', {'type': 'string', 'maxLength': 38, 'default': ''}),
("producer_first_name", {"type": "string", "maxLength": 32, "default": ""}), ('producer_first_name', {'type': 'string', 'maxLength': 32, 'default': ''}),
("producer_phone", {"type": "string", "maxLength": 20, "default": ""}), ('producer_phone', {'type': 'string', 'maxLength': 20, 'default': ''}),
("producer_email", {"type": "string", "maxLength": 50, "default": ""}), ('producer_email', {'type': 'string', 'maxLength': 50, 'default': ''}),
("owner_last_name", {"type": "string", "maxLength": 38, "default": ""}), ('owner_last_name', {'type': 'string', 'maxLength': 38, 'default': ''}),
("owner_first_name", {"type": "string", "maxLength": 32, "default": ""}), ('owner_first_name', {'type': 'string', 'maxLength': 32, 'default': ''}),
("owner_phone", {"type": "string", "maxLength": 20, "default": ""}), ('owner_phone', {'type': 'string', 'maxLength': 20, 'default': ''}),
("owner_email", {"type": "string", "maxLength": 50, "default": ""}), ('owner_email', {'type': 'string', 'maxLength': 50, 'default': ''}),
("activity_code", {"type": "integer", "default": 0}), ('activity_code', {'type': 'integer', 'default': 0}),
("family_members_number", {"type": "integer", "default": 0}), ('family_members_number', {'type': 'integer', 'default': 0}),
("houses_number", {"type": "integer", "default": 0}), ('houses_number', {'type': 'integer', 'default': 0}),
("t1_flats_number", {"type": "integer", "default": 0}), ('t1_flats_number', {'type': 'integer', 'default': 0}),
("t2_flats_number", {"type": "integer", "default": 0}), ('t2_flats_number', {'type': 'integer', 'default': 0}),
("t3_flats_number", {"type": "integer", "default": 0}), ('t3_flats_number', {'type': 'integer', 'default': 0}),
("t4_flats_number", {"type": "integer", "default": 0}), ('t4_flats_number', {'type': 'integer', 'default': 0}),
("t5_flats_number", {"type": "integer", "default": 0}), ('t5_flats_number', {'type': 'integer', 'default': 0}),
("t6_flats_number", {"type": "integer", "default": 0}), ('t6_flats_number', {'type': 'integer', 'default': 0}),
("shops_number", {"type": "integer", "default": 0}), ('shops_number', {'type': 'integer', 'default': 0}),
("garden_size", {"type": "integer", "default": 0}), ('garden_size', {'type': 'integer', 'default': 0}),
("expected_date", {"type": "string", "pattern": "^[0-9]{8}$", "default": ""}), ('expected_date', {'type': 'string', 'pattern': '^[0-9]{8}$', 'default': ''}),
("expected_time", {"type": "string", "pattern": "^[0-9]{4}$", "default": ""}), ('expected_time', {'type': 'string', 'pattern': '^[0-9]{4}$', 'default': ''}),
("modification_code", {"type": "integer", "default": 0}), ('modification_code', {'type': 'integer', 'default': 0}),
("demand_reason_label", {"type": "string", "default": ""}), ('demand_reason_label', {'type': 'string', 'default': ''}),
("comment", {"type": "string", "maxLength": 500, "default": ""}), ('comment', {'type': 'string', 'maxLength': 500, 'default': ''}),
) )
) )
CARD_SCHEMA = OrderedDict( CARD_SCHEMA = OrderedDict(
( (
( (
"card_subject", 'card_subject',
{ {
"type": "integer", 'type': 'integer',
}, },
), ),
( (
"card_type", 'card_type',
{ {
"type": "integer", 'type': 'integer',
}, },
), ),
( (
"card_demand_reason", 'card_demand_reason',
{ {
"type": "integer", 'type': 'integer',
}, },
), ),
( (
"cards_quantity", 'cards_quantity',
{ {
"type": "integer", 'type': 'integer',
}, },
), ),
( (
"card_number", 'card_number',
{ {
"type": "string", 'type': 'string',
"maxLength": 20, 'maxLength': 20,
}, },
), ),
( (
"card_bar_code", 'card_bar_code',
{ {
"type": "string", 'type': 'string',
"maxLength": 20, 'maxLength': 20,
"default": "", 'default': '',
}, },
), ),
( (
"card_code", 'card_code',
{ {
"type": "string", 'type': 'string',
"maxLength": 20, 'maxLength': 20,
"default": "", 'default': '',
}, },
), ),
( (
"card_validity_start_date", 'card_validity_start_date',
{ {
"type": "string", 'type': 'string',
"pattern": "^[0-9]{8}$", 'pattern': '^[0-9]{8}$',
"default": "", 'default': '',
}, },
), ),
( (
"card_validity_end_date", 'card_validity_end_date',
{ {
"type": "string", 'type': 'string',
"pattern": "^[0-9]{8}$", 'pattern': '^[0-9]{8}$',
"default": "", 'default': '',
}, },
), ),
( (
"card_comment", 'card_comment',
{ {
"type": "string", 'type': 'string',
"maxLength": 100, 'maxLength': 100,
"default": "", 'default': '',
}, },
), ),
) )
@ -191,24 +191,24 @@ DEMAND_SCHEMA = APPLICANT_SCHEMA.copy()
DEMAND_SCHEMA.update(CARD_SCHEMA) DEMAND_SCHEMA.update(CARD_SCHEMA)
SCHEMA = { SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#", '$schema': 'http://json-schema.org/draft-04/schema#',
"title": "Gesbac", 'title': 'Gesbac',
"description": "", 'description': '',
"type": "object", 'type': 'object',
"required": [ 'required': [
"form_id", 'form_id',
"demand_date", 'demand_date',
"demand_time", 'demand_time',
"producer_code", 'producer_code',
"city_insee_code", 'city_insee_code',
"street_rivoli_code", 'street_rivoli_code',
"street_name", 'street_name',
"card_subject", 'card_subject',
"card_type", 'card_type',
"card_demand_reason", 'card_demand_reason',
"cards_quantity", 'cards_quantity',
], ],
"properties": DEMAND_SCHEMA, 'properties': DEMAND_SCHEMA,
} }

View File

@ -33,9 +33,9 @@ ZONE_CHOICES = (
) )
HOLIDAYS_LABELS = { HOLIDAYS_LABELS = {
'winter_holidays': "Vacances dHiver", 'winter_holidays': 'Vacances dHiver',
'spring_holidays': 'Vacances de Pâques', 'spring_holidays': 'Vacances de Pâques',
'summer_holidays': "Vacances dÉté", 'summer_holidays': 'Vacances dÉté',
'all_saints_holidays': 'Vacances de la Toussaint', 'all_saints_holidays': 'Vacances de la Toussaint',
'christmas_holidays': 'Vacances de Noël', 'christmas_holidays': 'Vacances de Noël',
} }

View File

@ -36,9 +36,9 @@ def parse_datetime(datetime_str):
try: try:
obj = dateparse.parse_datetime(datetime_str) obj = dateparse.parse_datetime(datetime_str)
except ValueError: except ValueError:
raise APIError("Invalid datetime: %s" % datetime_str) raise APIError('Invalid datetime: %s' % datetime_str)
if obj is None: if obj is None:
raise APIError("Invalid datetime format: %s" % datetime_str) raise APIError('Invalid datetime format: %s' % datetime_str)
return obj return obj

View File

@ -60,7 +60,7 @@ class MDELBase:
class Common(MDELBase): class Common(MDELBase):
xmlns = "http://finances.gouv.fr/dgme/gf/composants/teledemarchexml/donnee/metier" xmlns = 'http://finances.gouv.fr/dgme/gf/composants/teledemarchexml/donnee/metier'
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.flow_type = args[0] self.flow_type = args[0]

View File

@ -43,15 +43,15 @@ STATUS_MAPPING = {
} }
APPLICANTS = [ APPLICANTS = [
{"id": "PersonneConcernee", "text": "La personne concernée par l'acte"}, {'id': 'PersonneConcernee', 'text': "La personne concernée par l'acte"},
{"id": "PereMere", "text": "Son père ou sa mère"}, {'id': 'PereMere', 'text': 'Son père ou sa mère'},
{"id": "Conjoint", "text": "Son conjoint ou sa conjointe"}, {'id': 'Conjoint', 'text': 'Son conjoint ou sa conjointe'},
{"id": "Fils", "text": "Son fils ou sa fille"}, {'id': 'Fils', 'text': 'Son fils ou sa fille'},
{"id": "GrandPere", "text": "Son grand-père ou sa grand-mère"}, {'id': 'GrandPere', 'text': 'Son grand-père ou sa grand-mère'},
{"id": "PetitFils", "text": "Son petit-fils ou sa petite-fille"}, {'id': 'PetitFils', 'text': 'Son petit-fils ou sa petite-fille'},
{"id": "Representant", "text": "Son représentant légal"}, {'id': 'Representant', 'text': 'Son représentant légal'},
{"id": "Heritier", "text": "Son héritier"}, {'id': 'Heritier', 'text': 'Son héritier'},
{"id": "Autre", "text": "Autre"}, {'id': 'Autre', 'text': 'Autre'},
] ]
CERTIFICATES = [ CERTIFICATES = [

View File

@ -55,6 +55,6 @@ class MobytSMSGateway(SMSResource):
r = self.requests.post(self.URL, data=params) r = self.requests.post(self.URL, data=params)
except requests.RequestException as e: except requests.RequestException as e:
raise APIError('MobyT error: POST failed, %s' % e) raise APIError('MobyT error: POST failed, %s' % e)
if r.text[:2] != "OK": if r.text[:2] != 'OK':
raise APIError('MobyT error: response is not "OK"') raise APIError('MobyT error: response is not "OK"')
# credit consumed is unknown # credit consumed is unknown

View File

@ -176,7 +176,7 @@ class Query(BaseQuery):
sort = models.CharField( sort = models.CharField(
verbose_name=_('Sort field'), verbose_name=_('Sort field'),
help_text=_( help_text=_(
"Sorts results by the specified field. A minus sign - may be used to perform an ascending sort." 'Sorts results by the specified field. A minus sign - may be used to perform an ascending sort.'
), ),
max_length=256, max_length=256,
blank=True, blank=True,

View File

@ -25,7 +25,7 @@ from .forms import QueryForm
class QueryNew(ResourceChildViewMixin, CreateView): class QueryNew(ResourceChildViewMixin, CreateView):
model = models.Query model = models.Query
form_class = QueryForm form_class = QueryForm
template_name = "passerelle/manage/resource_child_form.html" template_name = 'passerelle/manage/resource_child_form.html'
def get_form_kwargs(self): def get_form_kwargs(self):
kwargs = super().get_form_kwargs() kwargs = super().get_form_kwargs()
@ -36,9 +36,9 @@ class QueryNew(ResourceChildViewMixin, CreateView):
class QueryEdit(ResourceChildViewMixin, UpdateView): class QueryEdit(ResourceChildViewMixin, UpdateView):
model = models.Query model = models.Query
form_class = QueryForm form_class = QueryForm
template_name = "passerelle/manage/resource_child_form.html" template_name = 'passerelle/manage/resource_child_form.html'
class QueryDelete(ResourceChildViewMixin, DeleteView): class QueryDelete(ResourceChildViewMixin, DeleteView):
model = models.Query model = models.Query
template_name = "passerelle/manage/resource_child_confirm_delete.html" template_name = 'passerelle/manage/resource_child_confirm_delete.html'

View File

@ -393,8 +393,8 @@ class OpenGIS(BaseResource):
point_lon = closest_feature['geometry']['coordinates'][0] point_lon = closest_feature['geometry']['coordinates'][0]
point_lat = closest_feature['geometry']['coordinates'][1] point_lat = closest_feature['geometry']['coordinates'][1]
point_lon, point_lat = self.convert_coordinates(point_lon, point_lat, reverse=True) point_lon, point_lat = self.convert_coordinates(point_lon, point_lat, reverse=True)
result['lon'] = "%.6f" % point_lon result['lon'] = '%.6f' % point_lon
result['lat'] = "%.6f" % point_lat result['lat'] = '%.6f' % point_lat
result['address'] = {} result['address'] = {}
for attribute, properties in self.attributes_mapping: for attribute, properties in self.attributes_mapping:

View File

@ -144,14 +144,14 @@ class OVHSMSGateway(SMSResource):
body = json.dumps(kwargs['json']) if 'json' in kwargs else '' body = json.dumps(kwargs['json']) if 'json' in kwargs else ''
now = str(int(time.time())) now = str(int(time.time()))
signature = hashlib.sha1() signature = hashlib.sha1()
to_sign = "+".join((self.application_secret, self.consumer_key, method.upper(), url, body, now)) to_sign = '+'.join((self.application_secret, self.consumer_key, method.upper(), url, body, now))
signature.update(to_sign.encode()) signature.update(to_sign.encode())
headers = { headers = {
'X-Ovh-Application': self.application_key, 'X-Ovh-Application': self.application_key,
'X-Ovh-Consumer': self.consumer_key, 'X-Ovh-Consumer': self.consumer_key,
'X-Ovh-Timestamp': now, 'X-Ovh-Timestamp': now,
'X-Ovh-Signature': "$1$" + signature.hexdigest(), 'X-Ovh-Signature': '$1$' + signature.hexdigest(),
} }
try: try:

View File

@ -11,18 +11,18 @@ from .models import OVHSMSGateway
class RequestTokenView(RedirectView): class RequestTokenView(RedirectView):
def get_redirect_url(self, *args, **kwargs): def get_redirect_url(self, *args, **kwargs):
connector = OVHSMSGateway.objects.get(slug=kwargs["slug"]) connector = OVHSMSGateway.objects.get(slug=kwargs['slug'])
request_id = uuid.uuid4() request_id = uuid.uuid4()
confirm_token_url = reverse('ovh-confirm-token', kwargs={'slug': connector.slug, 'uuid': request_id}) confirm_token_url = reverse('ovh-confirm-token', kwargs={'slug': connector.slug, 'uuid': request_id})
data = { data = {
"accessRules": [ 'accessRules': [
{"method": "GET", "path": "/sms/%s/" % connector.account}, {'method': 'GET', 'path': '/sms/%s/' % connector.account},
{"method": "POST", "path": "/sms/%s/jobs/" % connector.account}, {'method': 'POST', 'path': '/sms/%s/jobs/' % connector.account},
], ],
"redirection": self.request.build_absolute_uri(confirm_token_url), 'redirection': self.request.build_absolute_uri(confirm_token_url),
} }
headers = {"X-Ovh-Application": connector.application_key} headers = {'X-Ovh-Application': connector.application_key}
try: try:
resp = connector.requests.post( resp = connector.requests.post(
@ -49,7 +49,7 @@ class RequestTokenView(RedirectView):
class ConfirmTokenView(RedirectView): class ConfirmTokenView(RedirectView):
def get_redirect_url(self, *args, **kwargs): def get_redirect_url(self, *args, **kwargs):
connector = OVHSMSGateway.objects.get(slug=kwargs["slug"]) connector = OVHSMSGateway.objects.get(slug=kwargs['slug'])
consumer_key = self.request.session.get('ovh-token-%s' % kwargs['uuid']) consumer_key = self.request.session.get('ovh-token-%s' % kwargs['uuid'])
if consumer_key: if consumer_key:

View File

@ -23,8 +23,8 @@ class OxydSMSGateway(SMSResource):
'err': 1, 'err': 1,
'err_desc': 'OXYD error: some destinations failed', 'err_desc': 'OXYD error: some destinations failed',
'data': [ 'data': [
['0033688888888', "OXYD error: response is not 200"], ['0033688888888', 'OXYD error: response is not 200'],
['0033677777777', "OXYD error: response is not 200"], ['0033677777777', 'OXYD error: response is not 200'],
], ],
}, },
}, },

View File

@ -422,7 +422,7 @@ class Query(BaseQuery):
) )
order = models.BooleanField( order = models.BooleanField(
verbose_name=_('Ascending sort order'), verbose_name=_('Ascending sort order'),
help_text=_("Unset to use descending sort order"), help_text=_('Unset to use descending sort order'),
default=True, default=True,
) )
limit = models.PositiveIntegerField( limit = models.PositiveIntegerField(

View File

@ -25,7 +25,7 @@ from .forms import QueryForm
class QueryNew(ResourceChildViewMixin, CreateView): class QueryNew(ResourceChildViewMixin, CreateView):
model = models.Query model = models.Query
form_class = QueryForm form_class = QueryForm
template_name = "passerelle/manage/resource_child_form.html" template_name = 'passerelle/manage/resource_child_form.html'
def get_form_kwargs(self): def get_form_kwargs(self):
kwargs = super().get_form_kwargs() kwargs = super().get_form_kwargs()
@ -36,9 +36,9 @@ class QueryNew(ResourceChildViewMixin, CreateView):
class QueryEdit(ResourceChildViewMixin, UpdateView): class QueryEdit(ResourceChildViewMixin, UpdateView):
model = models.Query model = models.Query
form_class = QueryForm form_class = QueryForm
template_name = "passerelle/manage/resource_child_form.html" template_name = 'passerelle/manage/resource_child_form.html'
class QueryDelete(ResourceChildViewMixin, DeleteView): class QueryDelete(ResourceChildViewMixin, DeleteView):
model = models.Query model = models.Query
template_name = "passerelle/manage/resource_child_confirm_delete.html" template_name = 'passerelle/manage/resource_child_confirm_delete.html'

View File

@ -134,7 +134,7 @@ class SignalArretes(BaseResource, HTTPResource):
def _get_value(self, endpoint, post_data=None, request_id=None): def _get_value(self, endpoint, post_data=None, request_id=None):
if request_id: if request_id:
url = f"{endpoint}/{request_id}" url = f'{endpoint}/{request_id}'
else: else:
url = endpoint url = endpoint

View File

@ -60,48 +60,48 @@ class SMSFactorSMSGateway(SMSResource):
{ {
'status_code': 200, 'status_code': 200,
'response': { 'response': {
"status": -7, 'status': -7,
"message": "Erreur de données", 'message': 'Erreur de données',
"details": "Texte du message introuvable", 'details': 'Texte du message introuvable',
}, },
'result': { 'result': {
'err': 1, 'err': 1,
'err_desc': 'SMS Factor error: some destinations failed', 'err_desc': 'SMS Factor error: some destinations failed',
'data': [ 'data': [
['33688888888', "Texte du message introuvable"], ['33688888888', 'Texte du message introuvable'],
['33677777777', "Texte du message introuvable"], ['33677777777', 'Texte du message introuvable'],
], ],
}, },
}, },
{ {
'status_code': 200, 'status_code': 200,
'response': { 'response': {
"status": 1, 'status': 1,
"message": "OK", 'message': 'OK',
"ticket": "14672468", 'ticket': '14672468',
"cost": 2, 'cost': 2,
"credits": 642, 'credits': 642,
"total": 2, 'total': 2,
"sent": 2, 'sent': 2,
"blacklisted": 0, 'blacklisted': 0,
"duplicated": 0, 'duplicated': 0,
"invalid": 0, 'invalid': 0,
"npai": 0, 'npai': 0,
}, },
'result': { 'result': {
'err': 0, 'err': 0,
'data': { 'data': {
"status": 1, 'status': 1,
"message": "OK", 'message': 'OK',
"ticket": "14672468", 'ticket': '14672468',
"cost": 2, 'cost': 2,
"credits": 642, 'credits': 642,
"total": 2, 'total': 2,
"sent": 2, 'sent': 2,
"blacklisted": 0, 'blacklisted': 0,
"duplicated": 0, 'duplicated': 0,
"invalid": 0, 'invalid': 0,
"npai": 0, 'npai': 0,
}, },
}, },
}, },
@ -113,8 +113,8 @@ class SMSFactorSMSGateway(SMSResource):
url = urllib.parse.urljoin(self.URL, endpoint) url = urllib.parse.urljoin(self.URL, endpoint)
headers = { headers = {
"Authorization": f"Bearer {self.auth_token}", 'Authorization': f'Bearer {self.auth_token}',
"Accept": "application/json", 'Accept': 'application/json',
} }
try: try:

View File

@ -45,8 +45,8 @@ class TwilioSMSGateway(SMSResource):
'err': 1, 'err': 1,
'err_desc': 'Twilio error: some destinations failed', 'err_desc': 'Twilio error: some destinations failed',
'data': [ 'data': [
['+33688888888', "Twilio error: my error message"], ['+33688888888', 'Twilio error: my error message'],
['+33677777777', "Twilio error: my error message"], ['+33677777777', 'Twilio error: my error message'],
], ],
}, },
}, },

View File

@ -25,108 +25,108 @@ from passerelle.utils.api import endpoint
from passerelle.utils.jsonresponse import APIError from passerelle.utils.jsonresponse import APIError
EVENTBOOK_SCHEMA = { EVENTBOOK_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#", '$schema': 'http://json-schema.org/draft-04/schema#',
"title": "Vivaticket", 'title': 'Vivaticket',
"description": "", 'description': '',
"type": "object", 'type': 'object',
"required": [ 'required': [
"id", 'id',
"email", 'email',
"start_datetime", 'start_datetime',
"end_datetime", 'end_datetime',
"event", 'event',
"theme", 'theme',
"room", 'room',
"quantity", 'quantity',
"form_url", 'form_url',
], ],
"properties": { 'properties': {
"id": { 'id': {
"description": "formdata id", 'description': 'formdata id',
"type": "string", 'type': 'string',
}, },
"title": { 'title': {
"description": "user title", 'description': 'user title',
"type": "string", 'type': 'string',
}, },
"last_name": { 'last_name': {
"description": "user last name", 'description': 'user last name',
"type": "string", 'type': 'string',
}, },
"first_name": { 'first_name': {
"description": "user first name", 'description': 'user first name',
"type": "string", 'type': 'string',
}, },
"social_reason": { 'social_reason': {
"description": "user social reason", 'description': 'user social reason',
"type": "string", 'type': 'string',
}, },
"address": { 'address': {
"description": "user address", 'description': 'user address',
"type": "string", 'type': 'string',
}, },
"zipcode": { 'zipcode': {
"description": "user zipcode", 'description': 'user zipcode',
"type": "string", 'type': 'string',
}, },
"city": { 'city': {
"description": "user city", 'description': 'user city',
"type": "string", 'type': 'string',
}, },
"country": { 'country': {
"description": "user country", 'description': 'user country',
"type": "string", 'type': 'string',
}, },
"phone": { 'phone': {
"description": "user phone", 'description': 'user phone',
"type": "string", 'type': 'string',
}, },
"mobile": { 'mobile': {
"description": "user mobile", 'description': 'user mobile',
"type": "string", 'type': 'string',
}, },
"email": { 'email': {
"description": "user email", 'description': 'user email',
"type": "string", 'type': 'string',
}, },
"start_datetime": { 'start_datetime': {
"description": "event start datetime", 'description': 'event start datetime',
"type": "string", 'type': 'string',
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}$", 'pattern': '^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}$',
}, },
"end_datetime": { 'end_datetime': {
"description": "event end datetime", 'description': 'event end datetime',
"type": "string", 'type': 'string',
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}$", 'pattern': '^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}$',
}, },
"event": { 'event': {
"description": "event id", 'description': 'event id',
"type": "string", 'type': 'string',
}, },
"theme": { 'theme': {
"description": "theme id", 'description': 'theme id',
"type": "string", 'type': 'string',
}, },
"room": { 'room': {
"description": "room id", 'description': 'room id',
"type": "string", 'type': 'string',
}, },
"quantity": {"description": "quantity", "type": "string", "pattern": "^[0-9]+$"}, 'quantity': {'description': 'quantity', 'type': 'string', 'pattern': '^[0-9]+$'},
"booking_comment": { 'booking_comment': {
"description": "booking comment", 'description': 'booking comment',
"type": "string", 'type': 'string',
}, },
"room_comment": { 'room_comment': {
"description": "room comment", 'description': 'room comment',
"type": "string", 'type': 'string',
}, },
"form_url": { 'form_url': {
"description": "form url", 'description': 'form url',
"type": "string", 'type': 'string',
}, },
"school_level": { 'school_level': {
"description": "School Level code", 'description': 'School Level code',
"type": "string", 'type': 'string',
}, },
}, },
} }
@ -192,7 +192,7 @@ class VivaTicket(BaseResource):
response = self.get(endpoint, **kwargs) response = self.get(endpoint, **kwargs)
json = response.json() json = response.json()
data = [] data = []
for setting in json.get("ListOfSettings", []): for setting in json.get('ListOfSettings', []):
data.append({'id': setting['Code'], 'text': setting['Label']}) data.append({'id': setting['Code'], 'text': setting['Label']})
return {'data': data} return {'data': data}

View File

@ -38,7 +38,7 @@ class Command(BaseCommand):
'ALTER COLUMN "%(column_name)s" TYPE jsonb USING "%(column_name)s"::jsonb' 'ALTER COLUMN "%(column_name)s" TYPE jsonb USING "%(column_name)s"::jsonb'
) )
params = { params = {
"schema_name": line[0], 'schema_name': line[0],
'table_name': table_name, 'table_name': table_name,
'column_name': column_name, 'column_name': column_name,
} }

View File

@ -169,7 +169,7 @@ class BaseResource(models.Model):
category = ( category = (
self.category if not hasattr(self.category, '_proxy____args') else self.category._proxy____args[0] self.category if not hasattr(self.category, '_proxy____args') else self.category._proxy____args[0]
) )
return "%s %s" % (slugify(category), self._meta.model_name) return '%s %s' % (slugify(category), self._meta.model_name)
def is_accessible_by(self, request): def is_accessible_by(self, request):
if request.user.is_superuser: if request.user.is_superuser:
@ -264,7 +264,7 @@ class BaseResource(models.Model):
hide_fields.extend(self.hide_description_fields) hide_fields.extend(self.hide_description_fields)
for field in self._meta.fields: for field in self._meta.fields:
if ( if (
field.name.endswith(("key", "password", "secret", "keystore", "token", "username")) field.name.endswith(('key', 'password', 'secret', 'keystore', 'token', 'username'))
or field.name in hide_fields or field.name in hide_fields
): ):
continue continue
@ -982,7 +982,7 @@ class ProxyLogger:
continue continue
if not parsed.username and not parsed.password: if not parsed.username and not parsed.password:
continue continue
replaced = parsed._replace(netloc="{}:{}@{}".format('***', '***', parsed.hostname)) replaced = parsed._replace(netloc='{}:{}@{}'.format('***', '***', parsed.hostname))
message = message.replace(url, replaced.geturl()) message = message.replace(url, replaced.geturl())
levelno = getattr(logging, levelname) levelno = getattr(logging, levelname)
@ -1031,7 +1031,7 @@ class ProxyLogger:
if getattr(request, 'META', None): if getattr(request, 'META', None):
if 'x-forwarded-for' in request.headers: if 'x-forwarded-for' in request.headers:
sourceip = request.headers.get('X-Forwarded-For', '').split(",")[0].strip() sourceip = request.headers.get('X-Forwarded-For', '').split(',')[0].strip()
else: else:
sourceip = request.META.get('REMOTE_ADDR') sourceip = request.META.get('REMOTE_ADDR')
else: else:

View File

@ -201,7 +201,7 @@ class CaluireAxel(BaseResource):
@endpoint( @endpoint(
display_category=_('Family account'), display_category=_('Family account'),
display_order=4, display_order=4,
description=_("Get information about children"), description=_('Get information about children'),
parameters={ parameters={
'NameID': {'description': _('Publik ID')}, 'NameID': {'description': _('Publik ID')},
}, },
@ -214,7 +214,7 @@ class CaluireAxel(BaseResource):
@endpoint( @endpoint(
display_category=_('Family account'), display_category=_('Family account'),
display_order=5, display_order=5,
description=_("Get information about a child"), description=_('Get information about a child'),
parameters={ parameters={
'NameID': {'description': _('Publik ID')}, 'NameID': {'description': _('Publik ID')},
'idpersonne': {'description': _('Child ID')}, 'idpersonne': {'description': _('Child ID')},
@ -298,7 +298,7 @@ class CaluireAxel(BaseResource):
@endpoint( @endpoint(
display_category=_('Schooling'), display_category=_('Schooling'),
display_order=1, display_order=1,
description=_("Get school list"), description=_('Get school list'),
parameters={ parameters={
'num': {'description': _('Address: number')}, 'num': {'description': _('Address: number')},
'street': {'description': _('Address: street')}, 'street': {'description': _('Address: street')},
@ -348,7 +348,7 @@ class CaluireAxel(BaseResource):
@endpoint( @endpoint(
display_category=_('Schooling'), display_category=_('Schooling'),
display_order=2, display_order=2,
description=_("Get information about schooling of a child"), description=_('Get information about schooling of a child'),
parameters={ parameters={
'NameID': {'description': _('Publik ID')}, 'NameID': {'description': _('Publik ID')},
'idpersonne': {'description': _('Child ID')}, 'idpersonne': {'description': _('Child ID')},
@ -427,7 +427,7 @@ class CaluireAxel(BaseResource):
@endpoint( @endpoint(
display_category=_('Schooling'), display_category=_('Schooling'),
display_order=3, display_order=3,
description=_("Get information about activities of a child for the year"), description=_('Get information about activities of a child for the year'),
parameters={ parameters={
'NameID': {'description': _('Publik ID')}, 'NameID': {'description': _('Publik ID')},
'idpersonne': {'description': _('Child ID')}, 'idpersonne': {'description': _('Child ID')},
@ -477,7 +477,7 @@ class CaluireAxel(BaseResource):
@endpoint( @endpoint(
display_category=_('Schooling'), display_category=_('Schooling'),
display_order=4, display_order=4,
description=_("Register a child for an activity"), description=_('Register a child for an activity'),
parameters={ parameters={
'NameID': {'description': _('Publik ID')}, 'NameID': {'description': _('Publik ID')},
}, },
@ -662,7 +662,7 @@ class CaluireAxel(BaseResource):
@endpoint( @endpoint(
display_category=_('Schooling'), display_category=_('Schooling'),
display_order=5, display_order=5,
description=_("Get agenda for an activity and a child"), description=_('Get agenda for an activity and a child'),
parameters={ parameters={
'NameID': {'description': _('Publik ID')}, 'NameID': {'description': _('Publik ID')},
'idpersonne': {'description': _('Child ID')}, 'idpersonne': {'description': _('Child ID')},
@ -743,7 +743,7 @@ class CaluireAxel(BaseResource):
@endpoint( @endpoint(
display_category=_('Schooling'), display_category=_('Schooling'),
display_order=6, display_order=6,
description=_("Get periscolaire agenda for a child"), description=_('Get periscolaire agenda for a child'),
parameters={ parameters={
'NameID': {'description': _('Publik ID')}, 'NameID': {'description': _('Publik ID')},
'idpersonne': {'description': _('Child ID')}, 'idpersonne': {'description': _('Child ID')},
@ -757,7 +757,7 @@ class CaluireAxel(BaseResource):
@endpoint( @endpoint(
display_category=_('Schooling'), display_category=_('Schooling'),
display_order=7, display_order=7,
description=_("Get full agenda for a child"), description=_('Get full agenda for a child'),
parameters={ parameters={
'NameID': {'description': _('Publik ID')}, 'NameID': {'description': _('Publik ID')},
'idpersonne': {'description': _('Child ID')}, 'idpersonne': {'description': _('Child ID')},
@ -844,7 +844,7 @@ class CaluireAxel(BaseResource):
continue continue
if activity_id not in exclusive_activity_ids: if activity_id not in exclusive_activity_ids:
continue continue
exclusive_activities["%s:%s" % (day, self.get_activity_type(activity_id))].add(booking) exclusive_activities['%s:%s' % (day, self.get_activity_type(activity_id))].add(booking)
# build list of existing booked days # build list of existing booked days
legacy_exclusive_activities = defaultdict(set) legacy_exclusive_activities = defaultdict(set)
for activity_id in exclusive_activity_ids: for activity_id in exclusive_activity_ids:
@ -857,7 +857,7 @@ class CaluireAxel(BaseResource):
continue continue
if activity_id not in exclusive_activity_ids: if activity_id not in exclusive_activity_ids:
continue continue
legacy_exclusive_activities["%s:%s" % (day, self.get_activity_type(activity_id))].add( legacy_exclusive_activities['%s:%s' % (day, self.get_activity_type(activity_id))].add(
booking['id'] booking['id']
) )
# check booking exclusivity for changes only # check booking exclusivity for changes only
@ -923,7 +923,7 @@ class CaluireAxel(BaseResource):
@endpoint( @endpoint(
display_category=_('Schooling'), display_category=_('Schooling'),
display_order=8, display_order=8,
description=_("Set agenda for a child"), description=_('Set agenda for a child'),
parameters={ parameters={
'NameID': {'description': _('Publik ID')}, 'NameID': {'description': _('Publik ID')},
}, },
@ -962,7 +962,7 @@ class CaluireAxel(BaseResource):
@endpoint( @endpoint(
display_category=_('Schooling'), display_category=_('Schooling'),
display_order=9, display_order=9,
description=_("Set agenda for a child, from changes applied to another child"), description=_('Set agenda for a child, from changes applied to another child'),
parameters={ parameters={
'NameID': {'description': _('Publik ID')}, 'NameID': {'description': _('Publik ID')},
}, },
@ -1040,7 +1040,7 @@ class CaluireAxel(BaseResource):
@endpoint( @endpoint(
display_category=_('Schooling'), display_category=_('Schooling'),
display_order=10, display_order=10,
description=_("Set activity agenda for a child with a typical week"), description=_('Set activity agenda for a child with a typical week'),
parameters={ parameters={
'NameID': {'description': _('Publik ID')}, 'NameID': {'description': _('Publik ID')},
}, },
@ -1178,7 +1178,7 @@ class CaluireAxel(BaseResource):
name='regie', name='regie',
pattern=r'^(?P<regie_id>[\w-]+)/invoices/?$', pattern=r'^(?P<regie_id>[\w-]+)/invoices/?$',
example_pattern='{regie_id}/invoices', example_pattern='{regie_id}/invoices',
description=_("Get invoices to pay"), description=_('Get invoices to pay'),
parameters={ parameters={
'NameID': {'description': _('Publik ID')}, 'NameID': {'description': _('Publik ID')},
'regie_id': {'description': _('Regie identifier'), 'example_value': 'ENF'}, 'regie_id': {'description': _('Regie identifier'), 'example_value': 'ENF'},
@ -1195,7 +1195,7 @@ class CaluireAxel(BaseResource):
name='regie', name='regie',
pattern=r'^(?P<regie_id>[\w-]+)/invoices/history/?$', pattern=r'^(?P<regie_id>[\w-]+)/invoices/history/?$',
example_pattern='{regie_id}/invoices/history', example_pattern='{regie_id}/invoices/history',
description=_("Get invoices already paid"), description=_('Get invoices already paid'),
parameters={ parameters={
'NameID': {'description': _('Publik ID')}, 'NameID': {'description': _('Publik ID')},
'regie_id': {'description': _('Regie identifier'), 'example_value': 'ENF'}, 'regie_id': {'description': _('Regie identifier'), 'example_value': 'ENF'},

View File

@ -541,7 +541,7 @@ class DPark(BaseResource):
value_errors = is_erroneous(value, ('filename', 'content'), silent=True) value_errors = is_erroneous(value, ('filename', 'content'), silent=True)
if value_errors: if value_errors:
value_errors = ["<%s> " % key + error for error in value_errors] value_errors = ['<%s> ' % key + error for error in value_errors]
errors.extend(value_errors) errors.extend(value_errors)
continue continue

View File

@ -33,16 +33,16 @@ def default_database():
if i > 5: if i > 5:
amount = total_amount amount = total_amount
else: else:
amount = "0.00" # paid amount = '0.00' # paid
invoices["F%d%0.2d-%d" % (day.year, day.month, random.randint(100, 999))] = { invoices['F%d%0.2d-%d' % (day.year, day.month, random.randint(100, 999))] = {
"amount": amount, 'amount': amount,
"label": "facture du %d/%d/%d" % (day.day, day.month, day.year), 'label': 'facture du %d/%d/%d' % (day.day, day.month, day.year),
"total_amount": total_amount, 'total_amount': total_amount,
"online_payment": i % 3 != 0, 'online_payment': i % 3 != 0,
"created": day.strftime('%Y-%m-%d'), 'created': day.strftime('%Y-%m-%d'),
"pay_limit_date": limit.strftime('%Y-%m-%d'), 'pay_limit_date': limit.strftime('%Y-%m-%d'),
"has_pdf": True, 'has_pdf': True,
"keywords": [], 'keywords': [],
} }
adults = {} adults = {}
@ -53,7 +53,7 @@ def default_database():
adult['password'] = 'pass%d' % i adult['password'] = 'pass%d' % i
adult['email'] = 'p%d@example.net' % i adult['email'] = 'p%d@example.net' % i
adult['text'] = '%(first_name)s %(last_name)s' % adult adult['text'] = '%(first_name)s %(last_name)s' % adult
adult['birthdate'] = "%d-%0.2d-18" % (now.year - random.randint(20, 40), random.randint(1, 12)) adult['birthdate'] = '%d-%0.2d-18' % (now.year - random.randint(20, 40), random.randint(1, 12))
adult['phone'] = '0122334455' adult['phone'] = '0122334455'
adult['cellphone'] = '0655443322' adult['cellphone'] = '0655443322'
adult['invoices'] = [] adult['invoices'] = []
@ -64,7 +64,7 @@ def default_database():
adult2.update(randomnames.person('adult')) adult2.update(randomnames.person('adult'))
adult2['last_name'] = adult['last_name'] adult2['last_name'] = adult['last_name']
adult2['text'] = '%(first_name)s %(last_name)s' % adult2 adult2['text'] = '%(first_name)s %(last_name)s' % adult2
adult2['birthdate'] = "%d-%0.2d-18" % (now.year - random.randint(20, 40), random.randint(1, 12)) adult2['birthdate'] = '%d-%0.2d-18' % (now.year - random.randint(20, 40), random.randint(1, 12))
adult2['login'] = 'p%d@example.net' % (i + 1) adult2['login'] = 'p%d@example.net' % (i + 1)
adult2['password'] = 'pass%d' % (i + 1) adult2['password'] = 'pass%d' % (i + 1)
adult2['email'] = 'p%d@example.net' % (i + 1) adult2['email'] = 'p%d@example.net' % (i + 1)
@ -75,59 +75,59 @@ def default_database():
for i in range(1, 51): for i in range(1, 51):
child = randomnames.person('child') child = randomnames.person('child')
child['text'] = '%(first_name)s %(last_name)s' % child child['text'] = '%(first_name)s %(last_name)s' % child
child['birthdate'] = "%d-%0.2d-18" % (now.year - random.randint(1, 14), random.randint(1, 12)) child['birthdate'] = '%d-%0.2d-18' % (now.year - random.randint(1, 14), random.randint(1, 12))
child['keywords'] = ["naissance-en-" + child['birthdate'][:4]] child['keywords'] = ['naissance-en-' + child['birthdate'][:4]]
child['id'] = i child['id'] = i
children['%d' % i] = child children['%d' % i] = child
database = { database = {
"links": { 'links': {
# "nameid": "adult_id", # "nameid": "adult_id",
"fake_nameid": "1", 'fake_nameid': '1',
}, },
"adults": adults, 'adults': adults,
"children": children, 'children': children,
"invoices": invoices, 'invoices': invoices,
"families": { 'families': {
"1": { '1': {
"id": "1", 'id': '1',
"adults": ["1", "2"], 'adults': ['1', '2'],
"children": ["1", "2"], 'children': ['1', '2'],
"contacts": ["10"], 'contacts': ['10'],
"invoices": [], 'invoices': [],
"keywords": ["deux-enfants", "habitant-14eme"], 'keywords': ['deux-enfants', 'habitant-14eme'],
}, },
"2": { '2': {
"id": "2", 'id': '2',
"adults": ["3"], 'adults': ['3'],
"children": ["3", "4"], 'children': ['3', '4'],
"contacts": [], 'contacts': [],
"invoices": [], 'invoices': [],
"keywords": ["deux-enfants", "habitant-14eme", "mono-parentale"], 'keywords': ['deux-enfants', 'habitant-14eme', 'mono-parentale'],
}, },
"3": { '3': {
"id": "3", 'id': '3',
"adults": ["5", "6"], 'adults': ['5', '6'],
"children": ["5"], 'children': ['5'],
"contacts": [], 'contacts': [],
"invoices": [], 'invoices': [],
"keywords": ["un-enfant", "habitant-14eme"], 'keywords': ['un-enfant', 'habitant-14eme'],
}, },
"4": { '4': {
"id": "4", 'id': '4',
"adults": ["7"], 'adults': ['7'],
"children": ["6"], 'children': ['6'],
"contacts": [], 'contacts': [],
"invoices": [], 'invoices': [],
"keywords": ["un-enfant", "habitant-14eme", "mono-parentale"], 'keywords': ['un-enfant', 'habitant-14eme', 'mono-parentale'],
}, },
"5": { '5': {
"id": "5", 'id': '5',
"adults": ["9", "10"], 'adults': ['9', '10'],
"children": [], 'children': [],
"contacts": ["15"], 'contacts': ['15'],
"invoices": [], 'invoices': [],
"keywords": ["sans-enfant", "habitant-14eme"], 'keywords': ['sans-enfant', 'habitant-14eme'],
}, },
}, },
} }

View File

@ -128,10 +128,10 @@ class Greco(BaseResource):
HttpAuthenticated.__init__(self) HttpAuthenticated.__init__(self)
def send(self, request): def send(self, request):
request.message = request.message.replace(b"contentType", b"xm:contentType") request.message = request.message.replace(b'contentType', b'xm:contentType')
if self.attachments: if self.attachments:
# SOAP Attachement format # SOAP Attachement format
message = MIMEMultipart('related', type="text/xml", start="<rootpart@entrouvert.org>") message = MIMEMultipart('related', type='text/xml', start='<rootpart@entrouvert.org>')
xml = MIMEText(None, _subtype='xml', _charset='utf-8') xml = MIMEText(None, _subtype='xml', _charset='utf-8')
xml.add_header('Content-ID', '<rootpart@entrouvert.org>') xml.add_header('Content-ID', '<rootpart@entrouvert.org>')
# do not base64-encode the soap message # do not base64-encode the soap message

View File

@ -63,12 +63,12 @@ def check_value(data, field_name, values):
def strip_emoji(value): def strip_emoji(value):
emoji_pattern = re.compile( emoji_pattern = re.compile(
"[" '['
"\U00002700-\U000027BF" # Dingbats '\U00002700-\U000027BF' # Dingbats
"\U0001F300-\U0001F5FF" # symbols & pictographs '\U0001F300-\U0001F5FF' # symbols & pictographs
"\U0001F600-\U0001F64F" # emoticons '\U0001F600-\U0001F64F' # emoticons
"\U0001F680-\U0001F6FF" # transport & map symbols '\U0001F680-\U0001F6FF' # transport & map symbols
"]+", ']+',
) )
return emoji_pattern.sub(r'', value) return emoji_pattern.sub(r'', value)
@ -83,7 +83,7 @@ class GrenobleGRU(BaseResource):
category = _('Business Process Connectors') category = _('Business Process Connectors')
class Meta: class Meta:
verbose_name = "Grenoble - Gestion des signalements" verbose_name = 'Grenoble - Gestion des signalements'
@classmethod @classmethod
def get_verbose_name(cls): def get_verbose_name(cls):

View File

@ -36,133 +36,133 @@ API_VERSION = [
API_VERSION_DEFAULT = '1.0.0' API_VERSION_DEFAULT = '1.0.0'
SITE_BOOKING_SCHOOL_SCHEMA = { SITE_BOOKING_SCHOOL_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#", '$schema': 'http://json-schema.org/draft-04/schema#',
"title": "ENS site/booking/school", 'title': 'ENS site/booking/school',
"description": "", 'description': '',
"type": "object", 'type': 'object',
"required": [ 'required': [
"site", 'site',
"date", 'date',
"pmr", 'pmr',
"morning", 'morning',
"lunch", 'lunch',
"afternoon", 'afternoon',
"participants", 'participants',
"grade_levels", 'grade_levels',
"beneficiary_first_name", 'beneficiary_first_name',
"beneficiary_last_name", 'beneficiary_last_name',
"beneficiary_email", 'beneficiary_email',
"beneficiary_phone", 'beneficiary_phone',
], ],
"properties": OrderedDict( 'properties': OrderedDict(
{ {
"external_id": { 'external_id': {
"description": "external id", 'description': 'external id',
"type": "string", 'type': 'string',
}, },
"site": { 'site': {
"description": "site id (code)", 'description': 'site id (code)',
"type": "string", 'type': 'string',
}, },
"project": { 'project': {
"description": "project code", 'description': 'project code',
"type": "string", 'type': 'string',
}, },
"date": { 'date': {
"description": "booking date (format: YYYY-MM-DD)", 'description': 'booking date (format: YYYY-MM-DD)',
"type": "string", 'type': 'string',
}, },
"pmr": { 'pmr': {
"description": "PMR", 'description': 'PMR',
"type": "boolean", 'type': 'boolean',
}, },
"morning": { 'morning': {
"description": "morning booking", 'description': 'morning booking',
"type": "boolean", 'type': 'boolean',
}, },
"lunch": { 'lunch': {
"description": "lunch booking", 'description': 'lunch booking',
"type": "boolean", 'type': 'boolean',
}, },
"afternoon": { 'afternoon': {
"description": "afternoon booking", 'description': 'afternoon booking',
"type": "boolean", 'type': 'boolean',
}, },
"participants": { 'participants': {
"description": "number of participants", 'description': 'number of participants',
"type": "string", 'type': 'string',
"pattern": "^[0-9]+$", 'pattern': '^[0-9]+$',
}, },
"animator": { 'animator': {
"description": "animator id", 'description': 'animator id',
"type": "string", 'type': 'string',
"pattern": "^[0-9]*$", 'pattern': '^[0-9]*$',
}, },
"group": { 'group': {
"description": "school group id (API v2.1.0/v2.1.1, use applicant if empty)", 'description': 'school group id (API v2.1.0/v2.1.1, use applicant if empty)',
"type": "string", 'type': 'string',
"pattern": "^[0-9]*$", 'pattern': '^[0-9]*$',
}, },
"applicant": { 'applicant': {
"description": "applicant", 'description': 'applicant',
"type": "string", 'type': 'string',
}, },
"grade_levels": { 'grade_levels': {
"description": "grade levels", 'description': 'grade levels',
"type": "array", 'type': 'array',
"items": { 'items': {
"type": "string", 'type': 'string',
"description": "level", 'description': 'level',
}, },
}, },
"beneficiary_first_name": { 'beneficiary_first_name': {
"description": "beneficiary first name", 'description': 'beneficiary first name',
"type": "string", 'type': 'string',
}, },
"beneficiary_last_name": { 'beneficiary_last_name': {
"description": "beneficiary last name", 'description': 'beneficiary last name',
"type": "string", 'type': 'string',
}, },
"beneficiary_email": { 'beneficiary_email': {
"description": "beneficiary email", 'description': 'beneficiary email',
"type": "string", 'type': 'string',
}, },
"beneficiary_phone": { 'beneficiary_phone': {
"description": "beneficiary phone number", 'description': 'beneficiary phone number',
"type": "string", 'type': 'string',
}, },
"beneficiary_cellphone": { 'beneficiary_cellphone': {
"description": "beneficiary cell phone number", 'description': 'beneficiary cell phone number',
"type": "string", 'type': 'string',
}, },
# v1.0.0 only # v1.0.0 only
"code": { 'code': {
"description": "booking code (API v1.0.0)", 'description': 'booking code (API v1.0.0)',
"type": "string", 'type': 'string',
}, },
"status": { 'status': {
"description": "booking status (API v1.0.0)", 'description': 'booking status (API v1.0.0)',
"type": "string", 'type': 'string',
}, },
"beneficiary_id": { 'beneficiary_id': {
"description": "beneficiary id (API v1.0.0)", 'description': 'beneficiary id (API v1.0.0)',
"type": "string", 'type': 'string',
}, },
"public": { 'public': {
"description": "public (API v1.0.0)", 'description': 'public (API v1.0.0)',
"type": "string", 'type': 'string',
}, },
"entity_id": { 'entity_id': {
"description": "entity/school id (UAI/RNE) (API v1.0.0)", 'description': 'entity/school id (UAI/RNE) (API v1.0.0)',
"type": "string", 'type': 'string',
}, },
"entity_name": { 'entity_name': {
"description": "entity/school name (API v1.0.0)", 'description': 'entity/school name (API v1.0.0)',
"type": "string", 'type': 'string',
}, },
"entity_type": { 'entity_type': {
"description": "entity/school type (API v1.0.0)", 'description': 'entity/school type (API v1.0.0)',
"type": "string", 'type': 'string',
}, },
} }
), ),
@ -170,15 +170,15 @@ SITE_BOOKING_SCHOOL_SCHEMA = {
class IsereENS(BaseResource, HTTPResource): class IsereENS(BaseResource, HTTPResource):
category = _("Business Process Connectors") category = _('Business Process Connectors')
base_url = models.URLField( base_url = models.URLField(
verbose_name=_("Webservice Base URL"), verbose_name=_('Webservice Base URL'),
help_text=_("Base API URL (before /api/...)"), help_text=_('Base API URL (before /api/...)'),
) )
token = models.CharField(verbose_name=_("Access token"), max_length=128) token = models.CharField(verbose_name=_('Access token'), max_length=128)
api_version = models.CharField( api_version = models.CharField(
verbose_name=_("API version"), max_length=10, choices=API_VERSION, default=API_VERSION_DEFAULT verbose_name=_('API version'), max_length=10, choices=API_VERSION, default=API_VERSION_DEFAULT
) )
class Meta: class Meta:
@ -186,7 +186,7 @@ class IsereENS(BaseResource, HTTPResource):
def request(self, endpoint, params=None, json=None, method='get'): def request(self, endpoint, params=None, json=None, method='get'):
url = urlparse.urljoin(self.base_url, endpoint) url = urlparse.urljoin(self.base_url, endpoint)
headers = {"token": self.token} headers = {'token': self.token}
if method == 'post' or json is not None: if method == 'post' or json is not None:
response = self.requests.post(url, params=params, json=json, headers=headers) response = self.requests.post(url, params=params, json=json, headers=headers)
else: else:
@ -198,169 +198,169 @@ class IsereENS(BaseResource, HTTPResource):
except ValueError: except ValueError:
json_content = None json_content = None
raise APIError( raise APIError(
"error status:%s %r, content:%r" 'error status:%s %r, content:%r'
% (response.status_code, response.reason, response.content[:1024]), % (response.status_code, response.reason, response.content[:1024]),
data={ data={
"status_code": response.status_code, 'status_code': response.status_code,
"json_content": json_content, 'json_content': json_content,
}, },
) )
if response.status_code == 204: # 204 No Content if response.status_code == 204: # 204 No Content
raise APIError("abnormal empty response") raise APIError('abnormal empty response')
try: try:
return response.json() return response.json()
except ValueError: except ValueError:
raise APIError("invalid JSON in response: %r" % response.content[:1024]) raise APIError('invalid JSON in response: %r' % response.content[:1024])
@endpoint( @endpoint(
name="sites", name='sites',
description=_("Sites"), description=_('Sites'),
display_order=1, display_order=1,
parameters={ parameters={
"q": {"description": _("Search text in name field")}, 'q': {'description': _('Search text in name field')},
"id": { 'id': {
"description": _("Returns site with code=id"), 'description': _('Returns site with code=id'),
}, },
"kind": { 'kind': {
"description": _("Returns only sites of this kind (school_group or social)"), 'description': _('Returns only sites of this kind (school_group or social)'),
}, },
}, },
) )
def sites(self, request, q=None, id=None, kind=None): def sites(self, request, q=None, id=None, kind=None):
if id is not None: if id is not None:
site = self.request("api/%s/site/%s" % (self.api_version, id)) site = self.request('api/%s/site/%s' % (self.api_version, id))
site["id"] = site["code"] site['id'] = site['code']
site["text"] = "%(name)s (%(city)s)" % site site['text'] = '%(name)s (%(city)s)' % site
sites = [site] sites = [site]
else: else:
cache_key = "isere-ens-sites-%d" % self.id cache_key = 'isere-ens-sites-%d' % self.id
sites = cache.get(cache_key) sites = cache.get(cache_key)
if not sites: if not sites:
sites = self.request("api/%s/site" % self.api_version) sites = self.request('api/%s/site' % self.api_version)
for site in sites: for site in sites:
site["id"] = site["code"] site['id'] = site['code']
site["text"] = "%(name)s (%(city)s)" % site site['text'] = '%(name)s (%(city)s)' % site
cache.set(cache_key, sites, 300) cache.set(cache_key, sites, 300)
if kind is not None: if kind is not None:
sites = [site for site in sites if site.get(kind)] sites = [site for site in sites if site.get(kind)]
if q is not None: if q is not None:
q = simplify(q) q = simplify(q)
sites = [site for site in sites if q in simplify(site["text"])] sites = [site for site in sites if q in simplify(site['text'])]
return {"data": sites} return {'data': sites}
@endpoint( @endpoint(
name="animators", name='animators',
description=_("Animators"), description=_('Animators'),
display_order=2, display_order=2,
parameters={ parameters={
"q": {"description": _("Search text in name field")}, 'q': {'description': _('Search text in name field')},
"id": { 'id': {
"description": _("Returns animator number id"), 'description': _('Returns animator number id'),
}, },
}, },
) )
def animators(self, request, q=None, id=None): def animators(self, request, q=None, id=None):
cache_key = "isere-ens-animators-%d" % self.id cache_key = 'isere-ens-animators-%d' % self.id
animators = cache.get(cache_key) animators = cache.get(cache_key)
if not animators: if not animators:
animators = self.request("api/%s/schoolAnimator" % self.api_version) animators = self.request('api/%s/schoolAnimator' % self.api_version)
for animator in animators: for animator in animators:
animator["id"] = str(animator["id"]) animator['id'] = str(animator['id'])
animator["text"] = "%(first_name)s %(last_name)s <%(email)s> (%(entity)s)" % animator animator['text'] = '%(first_name)s %(last_name)s <%(email)s> (%(entity)s)' % animator
cache.set(cache_key, animators, 300) cache.set(cache_key, animators, 300)
if id is not None: if id is not None:
animators = [animator for animator in animators if animator["id"] == id] animators = [animator for animator in animators if animator['id'] == id]
if q is not None: if q is not None:
q = simplify(q) q = simplify(q)
animators = [animator for animator in animators if q in simplify(animator["text"])] animators = [animator for animator in animators if q in simplify(animator['text'])]
return {"data": animators} return {'data': animators}
@endpoint( @endpoint(
name="site-calendar", name='site-calendar',
description=_("Available bookings for a site"), description=_('Available bookings for a site'),
display_order=3, display_order=3,
parameters={ parameters={
"site": {"description": _("Site code (aka id)")}, 'site': {'description': _('Site code (aka id)')},
"participants": { 'participants': {
"description": _("Number of participants"), 'description': _('Number of participants'),
}, },
"start_date": { 'start_date': {
"description": _("First date of the calendar (format: YYYY-MM-DD, default: today)"), 'description': _('First date of the calendar (format: YYYY-MM-DD, default: today)'),
}, },
"end_date": { 'end_date': {
"description": _( 'description': _(
"Last date of the calendar (format: YYYY-MM-DD, default: start_date + 92 days)" 'Last date of the calendar (format: YYYY-MM-DD, default: start_date + 92 days)'
), ),
}, },
}, },
) )
def site_calendar(self, request, site, participants="1", start_date=None, end_date=None): def site_calendar(self, request, site, participants='1', start_date=None, end_date=None):
if start_date: if start_date:
try: try:
start_date = datetime.datetime.strptime(start_date, "%Y-%m-%d").date() start_date = datetime.datetime.strptime(start_date, '%Y-%m-%d').date()
except ValueError: except ValueError:
raise APIError( raise APIError(
"bad start_date format (%s), should be YYYY-MM-DD" % start_date, 'bad start_date format (%s), should be YYYY-MM-DD' % start_date,
http_status=400, http_status=400,
) )
else: else:
start_date = datetime.date.today() start_date = datetime.date.today()
if end_date: if end_date:
try: try:
end_date = datetime.datetime.strptime(end_date, "%Y-%m-%d").date() end_date = datetime.datetime.strptime(end_date, '%Y-%m-%d').date()
except ValueError: except ValueError:
raise APIError( raise APIError(
"bad end_date format (%s), should be YYYY-MM-DD" % end_date, 'bad end_date format (%s), should be YYYY-MM-DD' % end_date,
http_status=400, http_status=400,
) )
else: else:
end_date = start_date + datetime.timedelta(days=92) end_date = start_date + datetime.timedelta(days=92)
params = { params = {
"participants": participants, 'participants': participants,
"start_date": start_date.strftime("%Y-%m-%d"), 'start_date': start_date.strftime('%Y-%m-%d'),
"end_date": end_date.strftime("%Y-%m-%d"), 'end_date': end_date.strftime('%Y-%m-%d'),
} }
dates = self.request("api/%s/site/%s/calendar" % (self.api_version, site), params=params) dates = self.request('api/%s/site/%s/calendar' % (self.api_version, site), params=params)
def status_name(status): def status_name(status):
return { return {
"AVAILABLE": _("available"), 'AVAILABLE': _('available'),
"COMPLETE": _("complete"), 'COMPLETE': _('complete'),
"OVERBOOKING": _("overbooking"), 'OVERBOOKING': _('overbooking'),
"OPEN": _("open"), 'OPEN': _('open'),
"CLOSE": _("closed"), 'CLOSE': _('closed'),
}.get(status) or _("unknown") }.get(status) or _('unknown')
for date in dates: for date in dates:
date["id"] = site + ":" + date["date"] date['id'] = site + ':' + date['date']
date["site"] = site date['site'] = site
date_ = datetime.datetime.strptime(date["date"], "%Y-%m-%d").date() date_ = datetime.datetime.strptime(date['date'], '%Y-%m-%d').date()
date["date_format"] = date_format(date_, format="DATE_FORMAT") date['date_format'] = date_format(date_, format='DATE_FORMAT')
date["date_number"] = date_format(date_, format="d") date['date_number'] = date_format(date_, format='d')
date["date_weekday"] = date_format(date_, format="l") date['date_weekday'] = date_format(date_, format='l')
date["date_weekdayindex"] = date_format(date_, format="w") date['date_weekdayindex'] = date_format(date_, format='w')
date["date_weeknumber"] = date_format(date_, format="W") date['date_weeknumber'] = date_format(date_, format='W')
date["date_month"] = date_format(date_, format="F Y") date['date_month'] = date_format(date_, format='F Y')
date["disabled"] = False date['disabled'] = False
date["status"] = "open" date['status'] = 'open'
for period in ("morning", "lunch", "afternoon"): for period in ('morning', 'lunch', 'afternoon'):
date["%s_status" % period] = status_name(date[period]) date['%s_status' % period] = status_name(date[period])
for period in ("morning", "afternoon"): for period in ('morning', 'afternoon'):
if date[period] in ("COMPLETE", "CLOSE"): if date[period] in ('COMPLETE', 'CLOSE'):
if date["status"] == "partially-open": if date['status'] == 'partially-open':
date["disabled"] = True date['disabled'] = True
date["status"] = "closed" date['status'] = 'closed'
else: else:
date["status"] = "partially-open" date['status'] = 'partially-open'
date["details"] = ( date['details'] = (
_("Morning (%(morning_status)s), Lunch (%(lunch_status)s), Afternoon (%(afternoon_status)s)") _('Morning (%(morning_status)s), Lunch (%(lunch_status)s), Afternoon (%(afternoon_status)s)')
% date % date
) )
date["text"] = "%(date_format)s - %(details)s" % date date['text'] = '%(date_format)s - %(details)s' % date
return {"data": dates} return {'data': dates}
def site_booking_v1(self, request, post_data): def site_booking_v1(self, request, post_data):
for key in ( for key in (
@ -377,56 +377,56 @@ class IsereENS(BaseResource, HTTPResource):
if key not in post_data: if key not in post_data:
raise APIError('%s is mandatory (API v1.0.0)' % key, err_code='bad-request', http_status=400) raise APIError('%s is mandatory (API v1.0.0)' % key, err_code='bad-request', http_status=400)
payload = { payload = {
"code": post_data["code"], 'code': post_data['code'],
"status": post_data["status"], 'status': post_data['status'],
"beneficiary": { 'beneficiary': {
"id": post_data["beneficiary_id"], 'id': post_data['beneficiary_id'],
"firstName": post_data["beneficiary_first_name"], 'firstName': post_data['beneficiary_first_name'],
"lastName": post_data["beneficiary_last_name"], 'lastName': post_data['beneficiary_last_name'],
"email": post_data["beneficiary_email"], 'email': post_data['beneficiary_email'],
"phone": post_data["beneficiary_phone"], 'phone': post_data['beneficiary_phone'],
"cellphone": post_data.get("beneficiary_cellphone", ""), 'cellphone': post_data.get('beneficiary_cellphone', ''),
}, },
"entity": { 'entity': {
"id": post_data["entity_id"], 'id': post_data['entity_id'],
"name": post_data["entity_name"], 'name': post_data['entity_name'],
"type": post_data["entity_type"], 'type': post_data['entity_type'],
}, },
"booking": { 'booking': {
"projectCode": post_data.get("project"), 'projectCode': post_data.get('project'),
"siteCode": post_data["site"], 'siteCode': post_data['site'],
"applicant": post_data["applicant"], 'applicant': post_data['applicant'],
"public": post_data["public"], 'public': post_data['public'],
"bookingDate": post_data["date"], 'bookingDate': post_data['date'],
"participants": int(post_data["participants"]), 'participants': int(post_data['participants']),
"morning": post_data["morning"], 'morning': post_data['morning'],
"lunch": post_data["lunch"], 'lunch': post_data['lunch'],
"afternoon": post_data["afternoon"], 'afternoon': post_data['afternoon'],
"pmr": post_data["pmr"], 'pmr': post_data['pmr'],
"gradeLevels": post_data["grade_levels"], 'gradeLevels': post_data['grade_levels'],
}, },
} }
if post_data.get("animator"): if post_data.get('animator'):
payload["booking"]["schoolAnimator"] = int(post_data["animator"]) payload['booking']['schoolAnimator'] = int(post_data['animator'])
booking = self.request("api/1.0.0/booking", json=payload) booking = self.request('api/1.0.0/booking', json=payload)
if not isinstance(booking, dict): if not isinstance(booking, dict):
raise APIError("response is not a dict", data=booking) raise APIError('response is not a dict', data=booking)
if "status" not in booking: if 'status' not in booking:
raise APIError("no status in response", data=booking) raise APIError('no status in response', data=booking)
if booking["status"] not in ("BOOKING", "OVERBOOKING"): if booking['status'] not in ('BOOKING', 'OVERBOOKING'):
raise APIError("booking status is %s" % booking["status"], data=booking) raise APIError('booking status is %s' % booking['status'], data=booking)
return {"data": booking} return {'data': booking}
@endpoint( @endpoint(
name="site-booking", name='site-booking',
description=_("Book a site for a school"), description=_('Book a site for a school'),
display_order=4, display_order=4,
methods=["post"], methods=['post'],
post={ post={
"request_body": { 'request_body': {
"schema": { 'schema': {
"application/json": SITE_BOOKING_SCHOOL_SCHEMA, 'application/json': SITE_BOOKING_SCHOOL_SCHEMA,
} }
} }
}, },
@ -435,20 +435,20 @@ class IsereENS(BaseResource, HTTPResource):
if self.api_version == '1.0.0': if self.api_version == '1.0.0':
return self.site_booking_v1(request, post_data) return self.site_booking_v1(request, post_data)
payload = { payload = {
"siteCode": post_data["site"], 'siteCode': post_data['site'],
"bookingDate": post_data["date"], 'bookingDate': post_data['date'],
"pmr": post_data["pmr"], 'pmr': post_data['pmr'],
"morning": post_data["morning"], 'morning': post_data['morning'],
"lunch": post_data["lunch"], 'lunch': post_data['lunch'],
"afternoon": post_data["afternoon"], 'afternoon': post_data['afternoon'],
"participants": int(post_data["participants"]), 'participants': int(post_data['participants']),
"gradeLevels": post_data["grade_levels"], 'gradeLevels': post_data['grade_levels'],
"beneficiary": { 'beneficiary': {
"firstName": post_data["beneficiary_first_name"], 'firstName': post_data['beneficiary_first_name'],
"lastName": post_data["beneficiary_last_name"], 'lastName': post_data['beneficiary_last_name'],
"email": post_data["beneficiary_email"], 'email': post_data['beneficiary_email'],
"phone": post_data["beneficiary_phone"], 'phone': post_data['beneficiary_phone'],
"cellphone": post_data.get("beneficiary_cellphone", ""), 'cellphone': post_data.get('beneficiary_cellphone', ''),
}, },
} }
if post_data.get('group'): if post_data.get('group'):
@ -471,19 +471,19 @@ class IsereENS(BaseResource, HTTPResource):
booking = self.request('api/' + self.api_version + '/site/booking/school', json=payload) booking = self.request('api/' + self.api_version + '/site/booking/school', json=payload)
if not isinstance(booking, dict): if not isinstance(booking, dict):
raise APIError("response is not a dict", data=booking) raise APIError('response is not a dict', data=booking)
if "status" not in booking: if 'status' not in booking:
raise APIError("no status in response", data=booking) raise APIError('no status in response', data=booking)
if booking["status"] not in ("BOOKING", "OVERBOOKING"): if booking['status'] not in ('BOOKING', 'OVERBOOKING'):
raise APIError("booking status is %s" % booking["status"], data=booking) raise APIError('booking status is %s' % booking['status'], data=booking)
return {"data": booking} return {'data': booking}
@endpoint( @endpoint(
name="get-site-booking", name='get-site-booking',
description=_("Booking status"), description=_('Booking status'),
display_order=5, display_order=5,
parameters={ parameters={
"code": {"description": _('Booking Code (API v1.0.0) or External ID (API v2.1.0/v2.1.1)')}, 'code': {'description': _('Booking Code (API v1.0.0) or External ID (API v2.1.0/v2.1.1)')},
}, },
) )
def get_site_booking(self, request, code): def get_site_booking(self, request, code):
@ -498,12 +498,12 @@ class IsereENS(BaseResource, HTTPResource):
return {'data': status} return {'data': status}
@endpoint( @endpoint(
name="cancel-site-booking", name='cancel-site-booking',
description=_("Cancel a booking"), description=_('Cancel a booking'),
methods=["post"], methods=['post'],
display_order=6, display_order=6,
parameters={ parameters={
"code": {"description": _('External ID')}, 'code': {'description': _('External ID')},
}, },
) )
def cancel_booking(self, request, code): def cancel_booking(self, request, code):

View File

@ -27,53 +27,53 @@ from passerelle.utils.api import endpoint
from passerelle.utils.conversion import any2bool from passerelle.utils.conversion import any2bool
from passerelle.utils.jsonresponse import APIError from passerelle.utils.jsonresponse import APIError
TYPE_AGENDA = {"DECHET": "DECHETS VERTS", "ENCOMBRANT": "ENCOMBRANTS"} TYPE_AGENDA = {'DECHET': 'DECHETS VERTS', 'ENCOMBRANT': 'ENCOMBRANTS'}
C_TYPEPB = {"DECHET": "8006", "ENCOMBRANT": "8008"} C_TYPEPB = {'DECHET': '8006', 'ENCOMBRANT': '8008'}
SYNDIC_C_TYPEPB = {"DECHET": "8007", "ENCOMBRANT": "8009"} SYNDIC_C_TYPEPB = {'DECHET': '8007', 'ENCOMBRANT': '8009'}
NS = '{http://isilog.fr}' NS = '{http://isilog.fr}'
BOOKDATE_SCHEMA = { BOOKDATE_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#", '$schema': 'http://json-schema.org/draft-04/schema#',
"title": "IWS", 'title': 'IWS',
"description": "", 'description': '',
"type": "object", 'type': 'object',
"required": ["firstname", "lastname", "email_notif", "date", "token"], 'required': ['firstname', 'lastname', 'email_notif', 'date', 'token'],
"properties": { 'properties': {
"firstname": { 'firstname': {
"description": "Firstname", 'description': 'Firstname',
"type": "string", 'type': 'string',
}, },
"lastname": { 'lastname': {
"description": "Lastname", 'description': 'Lastname',
"type": "string", 'type': 'string',
}, },
"email": { 'email': {
"description": "Email", 'description': 'Email',
"type": "string", 'type': 'string',
}, },
"email_notif": { 'email_notif': {
"description": "Email notification", 'description': 'Email notification',
"type": "boolean", 'type': 'boolean',
}, },
"description": { 'description': {
"description": "Description of the request", 'description': 'Description of the request',
"type": "string", 'type': 'string',
}, },
"tel_number": { 'tel_number': {
"description": "Telephone number", 'description': 'Telephone number',
"type": "string", 'type': 'string',
}, },
"date": { 'date': {
"description": "Booking date", 'description': 'Booking date',
"type": "string", 'type': 'string',
}, },
"token": { 'token': {
"description": "Booking token", 'description': 'Booking token',
"type": "string", 'type': 'string',
}, },
"sms": { 'sms': {
"description": "Send sms to user before the booked date", 'description': 'Send sms to user before the booked date',
}, },
}, },
} }
@ -103,7 +103,7 @@ class IWSConnector(BaseResource):
client.set_default_soapheaders([header_value]) client.set_default_soapheaders([header_value])
service = client.create_service('%sIsiHelpDeskServiceSoap' % NS, self.operation_endpoint) service = client.create_service('%sIsiHelpDeskServiceSoap' % NS, self.operation_endpoint)
self.logger.debug("calling %s method of iws", method, extra={'data': iws_data}) self.logger.debug('calling %s method of iws', method, extra={'data': iws_data})
IsiWsEntity = client.get_type('%sIsiWsEntity' % NS) IsiWsEntity = client.get_type('%sIsiWsEntity' % NS)
ArrayOfIsiWsDataField = client.get_type('%sArrayOfIsiWsDataField' % NS) ArrayOfIsiWsDataField = client.get_type('%sArrayOfIsiWsDataField' % NS)
IsiWsDataField = client.get_type('%sIsiWsDataField' % NS) IsiWsDataField = client.get_type('%sIsiWsDataField' % NS)
@ -123,13 +123,13 @@ class IWSConnector(BaseResource):
try: try:
tree = lxml.etree.fromstring(iws_res.encode('utf-8'), parser).getroottree() tree = lxml.etree.fromstring(iws_res.encode('utf-8'), parser).getroottree()
except lxml.etree.XMLSyntaxError: except lxml.etree.XMLSyntaxError:
raise APIError("IWS response is not valid") raise APIError('IWS response is not valid')
result = {"status": tree.find('//Statut').text, "trace": tree.find('//Trace').text} result = {'status': tree.find('//Statut').text, 'trace': tree.find('//Trace').text}
fields = {} fields = {}
for data_field in tree.xpath('//IsiWsDataField'): for data_field in tree.xpath('//IsiWsDataField'):
fields[data_field.find('IsiField').text] = data_field.find('IsiValue').text fields[data_field.find('IsiField').text] = data_field.find('IsiValue').text
result['fields'] = fields result['fields'] = fields
self.logger.debug("recieved data from %s method of iws", method, extra={'data': result}) self.logger.debug('recieved data from %s method of iws', method, extra={'data': result})
return result return result
def _check_status(self, iws_res): def _check_status(self, iws_res):
@ -168,7 +168,7 @@ class IWSConnector(BaseResource):
'I_AP_COMMUNE': city, 'I_AP_COMMUNE': city,
'I_AP_COMMUNEINTER': sti_code, 'I_AP_COMMUNEINTER': sti_code,
'J_PRJACTPREV': '5', 'J_PRJACTPREV': '5',
'C_EQUIPE': "VPVIGIE", 'C_EQUIPE': 'VPVIGIE',
'I_APP_DEMANDEUR': 'booking, demandeur', 'I_APP_DEMANDEUR': 'booking, demandeur',
'I_AP_ADRESSEMAIL': 'booking@localhost', 'I_AP_ADRESSEMAIL': 'booking@localhost',
'C_TYPEPB': SYNDIC_C_TYPEPB[request_type] if syndic else C_TYPEPB[request_type], 'C_TYPEPB': SYNDIC_C_TYPEPB[request_type] if syndic else C_TYPEPB[request_type],
@ -189,7 +189,7 @@ class IWSConnector(BaseResource):
raw_date = raw_date.strip() raw_date = raw_date.strip()
date_obj = datetime.strptime(raw_date, '%d/%m/%Y').date() date_obj = datetime.strptime(raw_date, '%d/%m/%Y').date()
date_text = dateformat.format(date_obj, 'l d F Y') date_text = dateformat.format(date_obj, 'l d F Y')
dates.append({"id": raw_date, "text": date_text, "token": token}) dates.append({'id': raw_date, 'text': date_text, 'token': token})
return result return result
@endpoint( @endpoint(

View File

@ -65,19 +65,19 @@ class LilleUrbanCard(BaseResource):
def csp(self, request, *args, **kwargs): def csp(self, request, *args, **kwargs):
return { return {
'data': [ 'data': [
{'id': '2', 'text': "Commerçant·e, chef·ffe dentreprise"}, {'id': '2', 'text': 'Commerçant·e, chef·ffe dentreprise'},
{'id': '3', 'text': "Cadre, profession libérale ou intellectuel·le"}, {'id': '3', 'text': 'Cadre, profession libérale ou intellectuel·le'},
{'id': '4', 'text': "Profession intermédiaire"}, {'id': '4', 'text': 'Profession intermédiaire'},
{'id': '5', 'text': "Employé·e"}, {'id': '5', 'text': 'Employé·e'},
{'id': '6', 'text': "Ouvrier·e"}, {'id': '6', 'text': 'Ouvrier·e'},
{'id': '1', 'text': "Agriculteur·rice"}, {'id': '1', 'text': 'Agriculteur·rice'},
{'id': '8', 'text': "Sans profession"}, {'id': '8', 'text': 'Sans profession'},
{'id': '81', 'text': "Demandeur·se demploi"}, {'id': '81', 'text': 'Demandeur·se demploi'},
{'id': '82', 'text': "Enfant de 0 à 11 ans"}, {'id': '82', 'text': 'Enfant de 0 à 11 ans'},
{'id': '83', 'text': "Enfant de plus de 12 ans"}, {'id': '83', 'text': 'Enfant de plus de 12 ans'},
{'id': '84', 'text': "Étudiant·e"}, {'id': '84', 'text': 'Étudiant·e'},
{'id': '7', 'text': "Retraité·e"}, {'id': '7', 'text': 'Retraité·e'},
{'id': '99', 'text': "Ne souhaite pas se prononcer"}, {'id': '99', 'text': 'Ne souhaite pas se prononcer'},
] ]
} }

View File

@ -40,169 +40,169 @@ DEFAULT_MAX_CAPACITY = 100000
CREATE_RESERVATION_SCHEMA = { CREATE_RESERVATION_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#", '$schema': 'http://json-schema.org/draft-04/schema#',
"title": "Planitech createreservation", 'title': 'Planitech createreservation',
"description": "", 'description': '',
"type": "object", 'type': 'object',
"required": [ 'required': [
"date", 'date',
"start_time", 'start_time',
"end_time", 'end_time',
"place_id", 'place_id',
"price", 'price',
"name_id", 'name_id',
"first_name", 'first_name',
"last_name", 'last_name',
"email", 'email',
"activity_id", 'activity_id',
"object", 'object',
"type_id", 'type_id',
"vat_rate", 'vat_rate',
], ],
"properties": { 'properties': {
"date": { 'date': {
"description": "Date", 'description': 'Date',
"type": "string", 'type': 'string',
}, },
"start_time": { 'start_time': {
"description": "Start time", 'description': 'Start time',
"type": "string", 'type': 'string',
}, },
"end_time": { 'end_time': {
"description": "End time", 'description': 'End time',
"type": "string", 'type': 'string',
}, },
"place_id": { 'place_id': {
"description": "Place identifier", 'description': 'Place identifier',
"type": "number", 'type': 'number',
}, },
"price": { 'price': {
"description": "Price", 'description': 'Price',
"type": "number", 'type': 'number',
}, },
"name_id": { 'name_id': {
"description": "Publik user nameID", 'description': 'Publik user nameID',
"type": "string", 'type': 'string',
}, },
"first_name": { 'first_name': {
"description": "First name", 'description': 'First name',
"type": "string", 'type': 'string',
}, },
"last_name": { 'last_name': {
"description": "Last name", 'description': 'Last name',
"type": "string", 'type': 'string',
}, },
"email": { 'email': {
"description": "Email", 'description': 'Email',
"type": "string", 'type': 'string',
}, },
"activity_id": { 'activity_id': {
"description": "Activity identifier", 'description': 'Activity identifier',
"type": "number", 'type': 'number',
}, },
"object": { 'object': {
"description": "Object", 'description': 'Object',
"type": "string", 'type': 'string',
}, },
"type_id": { 'type_id': {
"description": "Rerservation type identifier", 'description': 'Rerservation type identifier',
"type": "number", 'type': 'number',
}, },
"vat_rate": { 'vat_rate': {
"description": "VAT rate", 'description': 'VAT rate',
"type": "number", 'type': 'number',
}, },
"price_code": { 'price_code': {
"description": "User price code", 'description': 'User price code',
"type": "string", 'type': 'string',
}, },
}, },
} }
GET_RESERVATION_PRICE_SCHEMA = { GET_RESERVATION_PRICE_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#", '$schema': 'http://json-schema.org/draft-04/schema#',
"title": "Planitech getreservationprice", 'title': 'Planitech getreservationprice',
"description": "", 'description': '',
"type": "object", 'type': 'object',
"required": [ 'required': [
"date", 'date',
"start_time", 'start_time',
"end_time", 'end_time',
"place_id", 'place_id',
"name_id", 'name_id',
"first_name", 'first_name',
"last_name", 'last_name',
"email", 'email',
"activity_id", 'activity_id',
"type_id", 'type_id',
], ],
"properties": { 'properties': {
"date": { 'date': {
"description": "Date", 'description': 'Date',
"type": "string", 'type': 'string',
}, },
"start_time": { 'start_time': {
"description": "Start time", 'description': 'Start time',
"type": "string", 'type': 'string',
}, },
"end_time": { 'end_time': {
"description": "End time", 'description': 'End time',
"type": "string", 'type': 'string',
}, },
"place_id": { 'place_id': {
"description": "Place identifier", 'description': 'Place identifier',
"type": "number", 'type': 'number',
}, },
"name_id": { 'name_id': {
"description": "Publik user nameID", 'description': 'Publik user nameID',
"type": "string", 'type': 'string',
}, },
"first_name": { 'first_name': {
"description": "First name", 'description': 'First name',
"type": "string", 'type': 'string',
}, },
"last_name": { 'last_name': {
"description": "Last name", 'description': 'Last name',
"type": "string", 'type': 'string',
}, },
"email": { 'email': {
"description": "Email", 'description': 'Email',
"type": "string", 'type': 'string',
}, },
"activity_id": { 'activity_id': {
"description": "Activity identifier", 'description': 'Activity identifier',
"type": "number", 'type': 'number',
}, },
"type_id": { 'type_id': {
"description": "Rerservation type identifier", 'description': 'Rerservation type identifier',
"type": "number", 'type': 'number',
}, },
"price_code": { 'price_code': {
"description": "User price code", 'description': 'User price code',
"type": "string", 'type': 'string',
}, },
}, },
} }
RESERVATION_STATUS = {"confirmed": 3, "invalid": 0, " pre-reservation": 1, "standard": 2} RESERVATION_STATUS = {'confirmed': 3, 'invalid': 0, ' pre-reservation': 1, 'standard': 2}
UPDATE_RESERVATION_SCHEMA = { UPDATE_RESERVATION_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#", '$schema': 'http://json-schema.org/draft-04/schema#',
"title": "Planitech updatereservation", 'title': 'Planitech updatereservation',
"description": "", 'description': '',
"type": "object", 'type': 'object',
"required": ["reservation_id", "status"], 'required': ['reservation_id', 'status'],
"properties": { 'properties': {
"reservation_id": { 'reservation_id': {
"description": "Reservation Identifier", 'description': 'Reservation Identifier',
"type": "number", 'type': 'number',
}, },
"status": { 'status': {
"description": "Status of the reservation", 'description': 'Status of the reservation',
"type": "string", 'type': 'string',
"enum": list(RESERVATION_STATUS.keys()), 'enum': list(RESERVATION_STATUS.keys()),
}, },
}, },
} }
@ -211,14 +211,14 @@ UPDATE_RESERVATION_SCHEMA = {
def parse_date(date_str): def parse_date(date_str):
date_obj = dateparse.parse_date(date_str) date_obj = dateparse.parse_date(date_str)
if date_obj is None: if date_obj is None:
raise APIError("Invalid date format: %s" % date_str) raise APIError('Invalid date format: %s' % date_str)
return date_obj return date_obj
def parse_time(time_str): def parse_time(time_str):
timeobj = dateparse.parse_time(time_str) timeobj = dateparse.parse_time(time_str)
if timeobj is None: if timeobj is None:
raise APIError("Invalid time format: %s" % time_str) raise APIError('Invalid time format: %s' % time_str)
return timeobj return timeobj
@ -232,7 +232,7 @@ def compute_hash(content, hardness, salt):
def date_to_datetime(date_str): def date_to_datetime(date_str):
date_obj = parse_date(date_str) date_obj = parse_date(date_str)
if date_obj is None: if date_obj is None:
raise APIError("Invalid date string: %s" % date_str) raise APIError('Invalid date string: %s' % date_str)
return datetime.combine(date_obj, time(hour=12)) return datetime.combine(date_obj, time(hour=12))
@ -307,13 +307,13 @@ class PlanitechConnector(BaseResource):
kwargs['data'] = json.dumps(mste.encode(params)) kwargs['data'] = json.dumps(mste.encode(params))
response = session_meth(urlparse.urljoin(self.url, endpoint), **kwargs) response = session_meth(urlparse.urljoin(self.url, endpoint), **kwargs)
if response.status_code != 200: if response.status_code != 200:
error_msg = "Planitech error %s" % response.status_code error_msg = 'Planitech error %s' % response.status_code
try: try:
data = mste.decode(response.json()) data = mste.decode(response.json())
if hasattr(data, 'get'): if hasattr(data, 'get'):
error = data.get('errors') error = data.get('errors')
if error: if error:
error_msg += " - %s" % error error_msg += ' - %s' % error
except TypeError: except TypeError:
pass pass
raise APIError(error_msg) raise APIError(error_msg)
@ -344,8 +344,8 @@ class PlanitechConnector(BaseResource):
self.requests.post, self.requests.post,
'getPlacesInfo', 'getPlacesInfo',
{ {
"placeIdentifiers": [float(key) for key in ref], 'placeIdentifiers': [float(key) for key in ref],
"extensionAttributes": extensionAttributes, 'extensionAttributes': extensionAttributes,
}, },
) )
for place in data['requestedPlaces']: for place in data['requestedPlaces']:
@ -374,7 +374,7 @@ class PlanitechConnector(BaseResource):
try: try:
min_capacity, max_capacity = int(min_capacity), int(max_capacity) min_capacity, max_capacity = int(min_capacity), int(max_capacity)
except (ValueError, TypeError): except (ValueError, TypeError):
raise APIError("min_capacity and max_capacity must be integers") raise APIError('min_capacity and max_capacity must be integers')
for place_id, place_data in ref.items(): for place_id, place_data in ref.items():
# Filter on capacity # Filter on capacity
@ -416,7 +416,7 @@ class PlanitechConnector(BaseResource):
response.raise_for_status() response.raise_for_status()
# the last response should have set a cookie which will be used for authentication # the last response should have set a cookie which will be used for authentication
except RequestException as e: except RequestException as e:
raise APIError("Authentication to Planitec failed: %s" % str(e)) raise APIError('Authentication to Planitec failed: %s' % str(e))
def update_or_create_user(self, post_data): def update_or_create_user(self, post_data):
dyn_price_code = post_data.get('price_code') dyn_price_code = post_data.get('price_code')
@ -431,15 +431,15 @@ class PlanitechConnector(BaseResource):
if created: if created:
# Create planitec user # Create planitec user
params = { params = {
"externalUserIdentifier": pairing.external_id, 'externalUserIdentifier': pairing.external_id,
"name": post_data['last_name'], 'name': post_data['last_name'],
"firstName": post_data['first_name'], 'firstName': post_data['first_name'],
"mail": post_data['email'], 'mail': post_data['email'],
"pricingCode": price_code, 'pricingCode': price_code,
} }
data = self._call_planitech(self.requests.post, 'createPerson', params) data = self._call_planitech(self.requests.post, 'createPerson', params)
if data.get('creationStatus') != 'OK': if data.get('creationStatus') != 'OK':
raise APIError("Person creation failed: %s" % data.get('creationStatus')) raise APIError('Person creation failed: %s' % data.get('creationStatus'))
elif dyn_price_code and pairing.price_code != dyn_price_code: elif dyn_price_code and pairing.price_code != dyn_price_code:
# Update planitec user # Update planitec user
@ -448,7 +448,7 @@ class PlanitechConnector(BaseResource):
params = {'externalUserIdentifier': pairing.external_id, 'pricingCode': dyn_price_code} params = {'externalUserIdentifier': pairing.external_id, 'pricingCode': dyn_price_code}
data = self._call_planitech(self.requests.post, 'updatePerson', params) data = self._call_planitech(self.requests.post, 'updatePerson', params)
if data.get('modificationStatus') != 'OK': if data.get('modificationStatus') != 'OK':
raise APIError("Person update failed: %s" % data.get('modificationStatus')) raise APIError('Person update failed: %s' % data.get('modificationStatus'))
return pairing return pairing
@ -465,20 +465,20 @@ class PlanitechConnector(BaseResource):
pairing = self.update_or_create_user(post_data) pairing = self.update_or_create_user(post_data)
params = { params = {
"activityID": mste.Uint32(post_data['activity_id']), 'activityID': mste.Uint32(post_data['activity_id']),
"contractorExternalIdentifier": pairing.external_id, 'contractorExternalIdentifier': pairing.external_id,
"end": end_datetime, 'end': end_datetime,
"isWeekly": False, 'isWeekly': False,
"places": [float(post_data['place_id'])], 'places': [float(post_data['place_id'])],
"start": start_datetime, 'start': start_datetime,
"typeID": mste.Uint32(post_data['type_id']), 'typeID': mste.Uint32(post_data['type_id']),
} }
data = self._call_planitech(self.requests.post, 'getFutureReservationPrice', params) data = self._call_planitech(self.requests.post, 'getFutureReservationPrice', params)
if data.get('calculationStatus') != 'OK': if data.get('calculationStatus') != 'OK':
raise APIError("Get reservation price failed: %s" % data.get('calculationStatus')) raise APIError('Get reservation price failed: %s' % data.get('calculationStatus'))
price = data.get('calculatedPrice', False) price = data.get('calculatedPrice', False)
if price is False: if price is False:
raise APIError("Get reservation price failed: no price") raise APIError('Get reservation price failed: no price')
return {'data': {'price': int(price), 'raw_data': data}} return {'data': {'price': int(price), 'raw_data': data}}
@endpoint( @endpoint(
@ -495,17 +495,17 @@ class PlanitechConnector(BaseResource):
pairing = self.update_or_create_user(post_data) pairing = self.update_or_create_user(post_data)
params = { params = {
"activityID": mste.Uint32(post_data['activity_id']), 'activityID': mste.Uint32(post_data['activity_id']),
"contractorExternalIdentifier": pairing.external_id, 'contractorExternalIdentifier': pairing.external_id,
"end": end_datetime, 'end': end_datetime,
"isWeekly": False, 'isWeekly': False,
"object": post_data['object'], 'object': post_data['object'],
"places": [float(post_data['place_id'])], 'places': [float(post_data['place_id'])],
"price": mste.Uint32(post_data['price']), 'price': mste.Uint32(post_data['price']),
"requestDate": request_date, 'requestDate': request_date,
"start": start_datetime, 'start': start_datetime,
"typeID": mste.Uint32(post_data['type_id']), 'typeID': mste.Uint32(post_data['type_id']),
"vatRate": mste.Uint32(post_data['vat_rate']), 'vatRate': mste.Uint32(post_data['vat_rate']),
} }
extensions = get_extensions(post_data) extensions = get_extensions(post_data)
if extensions: if extensions:
@ -513,10 +513,10 @@ class PlanitechConnector(BaseResource):
data = self._call_planitech(self.requests.post, 'createReservation', params) data = self._call_planitech(self.requests.post, 'createReservation', params)
if data.get('creationStatus') != 'OK': if data.get('creationStatus') != 'OK':
raise APIError("Reservation creation failed: %s" % data.get('creationStatus')) raise APIError('Reservation creation failed: %s' % data.get('creationStatus'))
reservation_id = data.get('reservationIdentifier') reservation_id = data.get('reservationIdentifier')
if not reservation_id: if not reservation_id:
raise APIError("Reservation creation failed: no reservation ID") raise APIError('Reservation creation failed: no reservation ID')
return {'data': {'reservation_id': int(reservation_id), 'raw_data': data}} return {'data': {'reservation_id': int(reservation_id), 'raw_data': data}}
def hourly(self): def hourly(self):
@ -533,7 +533,7 @@ class PlanitechConnector(BaseResource):
for date_obj in available_dates: for date_obj in available_dates:
date_text = dateformat.format(date_obj, 'l d F Y') date_text = dateformat.format(date_obj, 'l d F Y')
short_text = dateformat.format(date_obj, 'd/m/Y') short_text = dateformat.format(date_obj, 'd/m/Y')
res.append({"id": date_obj.isoformat(), "text": date_text, "short_text": short_text}) res.append({'id': date_obj.isoformat(), 'text': date_text, 'short_text': short_text})
return res return res
def _place_display(self, raw_data): def _place_display(self, raw_data):
@ -543,7 +543,7 @@ class PlanitechConnector(BaseResource):
places_ref = self._raw_get_places_referential() places_ref = self._raw_get_places_referential()
res = [] res = []
for place in available_places: for place in available_places:
res.append({"id": place, "text": places_ref[place]['label']}) res.append({'id': place, 'text': places_ref[place]['label']})
return res return res
def _full_display(self, raw_data, places_id): def _full_display(self, raw_data, places_id):
@ -643,9 +643,9 @@ class PlanitechConnector(BaseResource):
# Additional parameters check # Additional parameters check
valid_displays = ['date', 'place', 'full'] valid_displays = ['date', 'place', 'full']
if display not in valid_displays: if display not in valid_displays:
raise APIError("Valid display are: %s" % ", ".join(valid_displays)) raise APIError('Valid display are: %s' % ', '.join(valid_displays))
if start_date is None and start_days is None: if start_date is None and start_days is None:
raise APIError("start_date or start_days is required") raise APIError('start_date or start_days is required')
# Starting date computation # Starting date computation
if start_date is not None: if start_date is not None:
@ -674,11 +674,11 @@ class PlanitechConnector(BaseResource):
).keys() ).keys()
params = { params = {
"placeIdentifiers": [float(p_id) for p_id in places_id], 'placeIdentifiers': [float(p_id) for p_id in places_id],
"startingDate": utc_start_datetime, 'startingDate': utc_start_datetime,
"endingDate": utc_end_datetime, 'endingDate': utc_end_datetime,
"requestedStartingTime": float(0), 'requestedStartingTime': float(0),
"requestedEndingTime": duration, 'requestedEndingTime': duration,
} }
if weekdays is not None: if weekdays is not None:
@ -770,8 +770,8 @@ class PlanitechConnector(BaseResource):
) )
def updatereservation(self, request, post_data): def updatereservation(self, request, post_data):
params = { params = {
"reservationIdentifier": mste.Uint32(post_data['reservation_id']), 'reservationIdentifier': mste.Uint32(post_data['reservation_id']),
"situation": mste.Uint32(RESERVATION_STATUS[post_data['status']]), 'situation': mste.Uint32(RESERVATION_STATUS[post_data['status']]),
} }
extensions = get_extensions(post_data) extensions = get_extensions(post_data)
if extensions: if extensions:
@ -779,7 +779,7 @@ class PlanitechConnector(BaseResource):
data = self._call_planitech(self.requests.post, 'updateReservation', params) data = self._call_planitech(self.requests.post, 'updateReservation', params)
if data.get('modificationStatus') != 'OK': if data.get('modificationStatus') != 'OK':
raise APIError("Update reservation failed: %s" % data.get('modificationStatus')) raise APIError('Update reservation failed: %s' % data.get('modificationStatus'))
return {'data': {'raw_data': data}} return {'data': {'raw_data': data}}
def check_status(self): def check_status(self):

View File

@ -111,7 +111,7 @@ class MSTEDecoder:
def _parse_item(self): def _parse_item(self):
token = self._next_token() token = self._next_token()
_type = DECODE_TOKENS[token] _type = DECODE_TOKENS[token]
return getattr(self, "_parse_%s" % _type)() return getattr(self, '_parse_%s' % _type)()
def _parse_localdate(self): def _parse_localdate(self):
timestamp = self._next_token() timestamp = self._next_token()
@ -245,7 +245,7 @@ class MSTEEncoder:
elif isinstance(obj, Uint32): elif isinstance(obj, Uint32):
self._encode_uint32(obj) self._encode_uint32(obj)
else: else:
raise TypeError("%s encoding not supported" % type(obj)) raise TypeError('%s encoding not supported' % type(obj))
def _encode_nil(self): def _encode_nil(self):
self._push_token_type('nil') self._push_token_type('nil')
@ -263,10 +263,10 @@ class MSTEEncoder:
self._push(obj) self._push(obj)
def encode(self): def encode(self):
res = ["MSTE0102"] res = ['MSTE0102']
self._encode_obj(self._data) self._encode_obj(self._data)
nb_token = 5 + len(self._keys_store) + len(self._stream) nb_token = 5 + len(self._keys_store) + len(self._stream)
res = ["MSTE0102", nb_token, 'CRC00000000', 0, len(self._keys_store)] + self._keys_store res = ['MSTE0102', nb_token, 'CRC00000000', 0, len(self._keys_store)] + self._keys_store
res.extend(self._stream) res.extend(self._stream)
return res return res

View File

@ -1424,69 +1424,69 @@ class RSA13Resource(BaseResource, HTTPResource):
display_order=12, display_order=12,
json_schema_response=response_schema( json_schema_response=response_schema(
{ {
"type": "object", 'type': 'object',
"properties": { 'properties': {
"avis_pi": { 'avis_pi': {
"type": "object", 'type': 'object',
"properties": { 'properties': {
"avis": {"type": "string"}, 'avis': {'type': 'string'},
"date": DATE_SCHEMA, 'date': DATE_SCHEMA,
"montant": {"type": "number"}, 'montant': {'type': 'number'},
}, },
}, },
"budget": { 'budget': {
"type": "object", 'type': 'object',
"properties": { 'properties': {
"date_reception": {"type": "string"}, 'date_reception': {'type': 'string'},
"justificatifs": { 'justificatifs': {
"type": "array", 'type': 'array',
"items": { 'items': {
"type": "object", 'type': 'object',
"properties": { 'properties': {
"conforme": {"type": "string"}, 'conforme': {'type': 'string'},
"date_reception": DATE_SCHEMA, 'date_reception': DATE_SCHEMA,
"date_relance": DATE_SCHEMA, 'date_relance': DATE_SCHEMA,
"num_versement": {"type": "integer"}, 'num_versement': {'type': 'integer'},
"reception": {"type": "string"}, 'reception': {'type': 'string'},
"type": {"type": "string"}, 'type': {'type': 'string'},
}, },
}, },
}, },
"nombre_versements": {"type": "integer"}, 'nombre_versements': {'type': 'integer'},
}, },
}, },
"cloture": { 'cloture': {
"type": "object", 'type': 'object',
"properties": { 'properties': {
"date_cloture": DATE_SCHEMA, 'date_cloture': DATE_SCHEMA,
"date_relance": DATE_SCHEMA, 'date_relance': DATE_SCHEMA,
}, },
}, },
"code_tfi": {"type": "string"}, 'code_tfi': {'type': 'string'},
"decision_sai": { 'decision_sai': {
"type": "object", 'type': 'object',
"properties": { 'properties': {
"date": DATE_SCHEMA, 'date': DATE_SCHEMA,
"decision": {"type": "string"}, 'decision': {'type': 'string'},
"montant": {"type": "number"}, 'montant': {'type': 'number'},
}, },
}, },
"demande": { 'demande': {
"type": "object", 'type': 'object',
"properties": { 'properties': {
"date": DATE_SCHEMA, 'date': DATE_SCHEMA,
"montant": {"type": "number"}, 'montant': {'type': 'number'},
}, },
}, },
"id": {"type": "integer"}, 'id': {'type': 'integer'},
"lib_tfi": {"type": "string"}, 'lib_tfi': {'type': 'string'},
"recours": { 'recours': {
"type": "object", 'type': 'object',
"properties": { 'properties': {
"date_decision": DATE_SCHEMA, 'date_decision': DATE_SCHEMA,
"date_demande": DATE_SCHEMA, 'date_demande': DATE_SCHEMA,
"decision": {"type": "string"}, 'decision': {'type': 'string'},
"montant": {"type": "string"}, 'montant': {'type': 'string'},
}, },
}, },
}, },
@ -1737,23 +1737,23 @@ class RSA13Resource(BaseResource, HTTPResource):
{ {
'type': 'array', 'type': 'array',
'items': { 'items': {
"type": "object", 'type': 'object',
"properties": { 'properties': {
"convos_par_motif": { 'convos_par_motif': {
"type": "array", 'type': 'array',
"items": { 'items': {
"type": "object", 'type': 'object',
"properties": { 'properties': {
"nombre": {"type": "integer"}, 'nombre': {'type': 'integer'},
"motif": {"type": "string"}, 'motif': {'type': 'string'},
}, },
}, },
}, },
"derniere_consequence": { 'derniere_consequence': {
"type": "object", 'type': 'object',
"properties": { 'properties': {
"date": DATE_SCHEMA, 'date': DATE_SCHEMA,
"consequence": {"type": "string"}, 'consequence': {'type': 'string'},
}, },
}, },
}, },
@ -1793,22 +1793,22 @@ class RSA13Resource(BaseResource, HTTPResource):
{ {
'type': 'array', 'type': 'array',
'items': { 'items': {
"type": "object", 'type': 'object',
"properties": { 'properties': {
"id": {"type": "string"}, 'id': {'type': 'string'},
"code_axe": {"type": "string"}, 'code_axe': {'type': 'string'},
"lib_axe": {"type": "string"}, 'lib_axe': {'type': 'string'},
"code_rome": {"type": "string"}, 'code_rome': {'type': 'string'},
"lib_rome": {"type": "string"}, 'lib_rome': {'type': 'string'},
"code_categorie": {"type": "string"}, 'code_categorie': {'type': 'string'},
"lib_categorie": {"type": "string"}, 'lib_categorie': {'type': 'string'},
"lib_secteur": {"type": "string"}, 'lib_secteur': {'type': 'string'},
"lib_niveau": {"type": "string"}, 'lib_niveau': {'type': 'string'},
"lib_modalite": {"type": "string"}, 'lib_modalite': {'type': 'string'},
"date_inscription": DATE_SCHEMA, 'date_inscription': DATE_SCHEMA,
"date_sortie": DATE_SCHEMA, 'date_sortie': DATE_SCHEMA,
"motif_sortie": {"type": "string"}, 'motif_sortie': {'type': 'string'},
"date_dernier_ent": DATE_SCHEMA, 'date_dernier_ent': DATE_SCHEMA,
}, },
}, },
} }
@ -1840,12 +1840,12 @@ class RSA13Resource(BaseResource, HTTPResource):
{ {
'type': 'array', 'type': 'array',
'items': { 'items': {
"type": "object", 'type': 'object',
"properties": { 'properties': {
"id": {"type": "string"}, 'id': {'type': 'string'},
"text": {"type": "string"}, 'text': {'type': 'string'},
"date_deb": {"type": "string"}, 'date_deb': {'type': 'string'},
"date_fin": {"type": "string"}, 'date_fin': {'type': 'string'},
}, },
}, },
} }
@ -1979,31 +1979,31 @@ class RSA13Resource(BaseResource, HTTPResource):
DEFAULTS = { DEFAULTS = {
'beneficiaire_csv_columns': [ 'beneficiaire_csv_columns': [
"NUM_CAF", 'NUM_CAF',
"CODE_PER", 'CODE_PER',
"NOM_PER", 'NOM_PER',
"PRENOM_PER", 'PRENOM_PER',
"DTNAI_PER", 'DTNAI_PER',
"ACTIF_PER", 'ACTIF_PER',
"CODE_PI", 'CODE_PI',
"LIB_CODE_PI", 'LIB_CODE_PI',
"TOPPERSDRODEVORSA", 'TOPPERSDRODEVORSA',
"LIB_ETATDOSRSA", 'LIB_ETATDOSRSA',
"LIB_MOTIF_ETATDOSRSA", 'LIB_MOTIF_ETATDOSRSA',
"NB_JOUR_DEPUIS_ARR", 'NB_JOUR_DEPUIS_ARR',
"DATE_DEB", 'DATE_DEB',
"DATE_1IERE_CONS", 'DATE_1IERE_CONS',
"DATE_DERNIERE_CONSULT", 'DATE_DERNIERE_CONSULT',
"DATE_REELLE_RDV", 'DATE_REELLE_RDV',
"NUM_CINS", 'NUM_CINS',
"DATE_SIGN", 'DATE_SIGN',
"DATE_DEB_CI", 'DATE_DEB_CI',
"DATE_FIN_CI", 'DATE_FIN_CI',
"REFERENT_CI", 'REFERENT_CI',
"ACTION_EN_COURS", 'ACTION_EN_COURS',
"DELAI_REGUL", 'DELAI_REGUL',
"PROC_EN_COURS", 'PROC_EN_COURS',
"REFERENT_AFFECTATION", 'REFERENT_AFFECTATION',
'COMPL1_ADR', 'COMPL1_ADR',
'COMPL2_ADR', 'COMPL2_ADR',
'VOIE_ADR', 'VOIE_ADR',
@ -2013,57 +2013,57 @@ DEFAULTS = {
'INSEE_ADR', 'INSEE_ADR',
], ],
'facturation_csv_columns': [ 'facturation_csv_columns': [
"PLATEFORME", 'PLATEFORME',
"MATRICULE", 'MATRICULE',
"NOM", 'NOM',
"PRENOM", 'PRENOM',
"DTNAI", 'DTNAI',
"GENRE", 'GENRE',
"ROLE", 'ROLE',
"CODE_POSTAL", 'CODE_POSTAL',
"COMMUNE", 'COMMUNE',
"DATE_SIGN", 'DATE_SIGN',
"DATE_DEB", 'DATE_DEB',
"DUREE", 'DUREE',
"DATE_FIN", 'DATE_FIN',
"COEFFICIENT", 'COEFFICIENT',
], ],
'sorti_csv_columns': [ 'sorti_csv_columns': [
"NUM_CAF", 'NUM_CAF',
"CODE_PER", 'CODE_PER',
"NOM_PER", 'NOM_PER',
"PRENOM_PER", 'PRENOM_PER',
"DTNAI_PER", 'DTNAI_PER',
"CP_PER", 'CP_PER',
"COMMUNE_PER", 'COMMUNE_PER',
"ACTIF_PER", 'ACTIF_PER',
"CODE_PI", 'CODE_PI',
"LIB_CODE_PI", 'LIB_CODE_PI',
"TOPPERSDRODEVORSA", 'TOPPERSDRODEVORSA',
"LIB_ETATDOSRSA", 'LIB_ETATDOSRSA',
"LIB_MOTIF_ETATDOSRSA", 'LIB_MOTIF_ETATDOSRSA',
"PLT_DT_DEB_AFF", 'PLT_DT_DEB_AFF',
"PLT_DT_FIN_AFF", 'PLT_DT_FIN_AFF',
"PLT_MOTIF_FIN_ACC", 'PLT_MOTIF_FIN_ACC',
"PLT_COMMENTAIRE_REF", 'PLT_COMMENTAIRE_REF',
"PLT_NUM_CI", 'PLT_NUM_CI',
"PLT_PLATEFORME_CI", 'PLT_PLATEFORME_CI',
"PLT_OPERATEUR_CI", 'PLT_OPERATEUR_CI',
"PLT_REFERENT_CI", 'PLT_REFERENT_CI',
"PLT_DECISION_CI", 'PLT_DECISION_CI',
"PLT_DUREE_CI", 'PLT_DUREE_CI',
"PLT_DATE_DEB_CI", 'PLT_DATE_DEB_CI',
"PLT_DATE_FIN_CI", 'PLT_DATE_FIN_CI',
"NOUVEAU_DT_DEB_AFF", 'NOUVEAU_DT_DEB_AFF',
"NOUVEAU_AFF", 'NOUVEAU_AFF',
"NOUVEAU_COMMENTAIRE_PI", 'NOUVEAU_COMMENTAIRE_PI',
"NOUVEAU_NUM_CI", 'NOUVEAU_NUM_CI',
"NOUVEAU_PLATEFORME_CI", 'NOUVEAU_PLATEFORME_CI',
"NOUVEAU_OPERATEUR_CI", 'NOUVEAU_OPERATEUR_CI',
"NOUVEAU_REFERENT_CI", 'NOUVEAU_REFERENT_CI',
"NOUVEAU_DECISION_CI", 'NOUVEAU_DECISION_CI',
"NOUVEAU_DUREE_CI", 'NOUVEAU_DUREE_CI',
"NOUVEAU_DATE_DEB_CI", 'NOUVEAU_DATE_DEB_CI',
"NOUVEAU_DATE_FIN_CI", 'NOUVEAU_DATE_FIN_CI',
], ],
} }

View File

@ -25,11 +25,11 @@ from passerelle.utils.jsonresponse import APIError
CREATE_SCHEMA = { CREATE_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#', '$schema': 'http://json-schema.org/draft-04/schema#',
"type": "object", 'type': 'object',
'required': ['demandeur', 'id_typeinterv', 'id_urgence'], 'required': ['demandeur', 'id_typeinterv', 'id_urgence'],
'properties': { 'properties': {
'demandeur': { 'demandeur': {
'description': "Nom du demandeur", 'description': 'Nom du demandeur',
'type': 'string', 'type': 'string',
}, },
'id_typeinterv': { 'id_typeinterv': {
@ -62,7 +62,7 @@ CREATE_SCHEMA = {
QUERY_SCHEMA = { QUERY_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#', '$schema': 'http://json-schema.org/draft-04/schema#',
"type": "object", 'type': 'object',
'properties': { 'properties': {
'id_intervention': { 'id_intervention': {
'description': 'Rechercher une intervention par son numéro' 'description': 'Rechercher une intervention par son numéro'

View File

@ -25,7 +25,7 @@ from passerelle.utils.jsonresponse import APIError
CONTACT_SCHEMA = { CONTACT_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#', '$schema': 'http://json-schema.org/draft-04/schema#',
"type": "object", 'type': 'object',
'properties': { 'properties': {
'adresseMailPerso': { 'adresseMailPerso': {
'description': 'Private mail address', 'description': 'Private mail address',
@ -48,7 +48,7 @@ CONTACT_SCHEMA = {
TAX_SCHEMA = { TAX_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#', '$schema': 'http://json-schema.org/draft-04/schema#',
"type": "object", 'type': 'object',
'properties': { 'properties': {
'indexImposition': { 'indexImposition': {
'description': 'Tax index', 'description': 'Tax index',
@ -76,7 +76,7 @@ TAX_SCHEMA = {
DEMAND_SCHEMA = { DEMAND_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#', '$schema': 'http://json-schema.org/draft-04/schema#',
"type": "object", 'type': 'object',
'properties': { 'properties': {
'codeTypeAide': { 'codeTypeAide': {
'description': 'Allowance type code', 'description': 'Allowance type code',
@ -117,21 +117,21 @@ DOCUMENT_SCHEMA = {
'type': 'object', 'type': 'object',
'properties': { 'properties': {
'codeGedDocument': { 'codeGedDocument': {
'description': "Code du document dans le paramétrage GED", 'description': 'Code du document dans le paramétrage GED',
}, },
'document': { 'document': {
'type': 'object', 'type': 'object',
'properties': { 'properties': {
'filename': { 'filename': {
'description': "Nom du ficher", 'description': 'Nom du ficher',
'type': 'string', 'type': 'string',
}, },
'content_type': { 'content_type': {
'description': "Type MIME", 'description': 'Type MIME',
'type': 'string', 'type': 'string',
}, },
'content': { 'content': {
'description': "Contenu", 'description': 'Contenu',
'type': 'string', 'type': 'string',
}, },
}, },
@ -285,7 +285,7 @@ class SolisAfiMss(BaseResource, HTTPResource):
display_order=5, display_order=5,
name='update-contact', name='update-contact',
methods=['post'], methods=['post'],
description=_("Update contact details for an agent"), description=_('Update contact details for an agent'),
parameters={ parameters={
'email': {'description': _("Agent's email address")}, 'email': {'description': _("Agent's email address")},
}, },
@ -404,7 +404,7 @@ class SolisAfiMss(BaseResource, HTTPResource):
for person in results['adults'] + results['children']: for person in results['adults'] + results['children']:
for index in [x.strip() for x in post_data['individusConcernes'].split(':') if x.strip()]: for index in [x.strip() for x in post_data['individusConcernes'].split(':') if x.strip()]:
if str(person['indexIndividu']) == index: if str(person['indexIndividu']) == index:
related_persons.append({"indexIndividu": index}) related_persons.append({'indexIndividu': index})
post_data['indexAgent'] = str(results['index']) post_data['indexAgent'] = str(results['index'])
post_data['individusConcernes'] = related_persons post_data['individusConcernes'] = related_persons
@ -421,7 +421,7 @@ class SolisAfiMss(BaseResource, HTTPResource):
description=_('Submit a document to the GED'), description=_('Submit a document to the GED'),
parameters={ parameters={
'email': {'description': _("Agent's email address"), 'optional': True}, 'email': {'description': _("Agent's email address"), 'optional': True},
'indexAideFinanciere': {'description': _("Allowance index"), 'optional': True}, 'indexAideFinanciere': {'description': _('Allowance index'), 'optional': True},
}, },
post={'request_body': {'schema': {'application/json': DOCUMENT_SCHEMA}}}, post={'request_body': {'schema': {'application/json': DOCUMENT_SCHEMA}}},
) )

View File

@ -16,7 +16,7 @@
CONCILIATION_INDIVIDU = { CONCILIATION_INDIVIDU = {
'block': {'name': 'Individu', 'pk': "PK/IndexIndividu/@V"}, 'block': {'name': 'Individu', 'pk': 'PK/IndexIndividu/@V'},
'criteria': { 'criteria': {
5: ( 5: (
{ {
@ -56,23 +56,23 @@ CONCILIATION_INDIVIDU = {
'EtatCivil/NomJeuneFille/@V': 'nom', 'EtatCivil/NomJeuneFille/@V': 'nom',
}, },
'output': [ 'output': [
"Dossier/PK/IndexDossier/@V", 'Dossier/PK/IndexDossier/@V',
"PK/IndexIndividu/@V", 'PK/IndexIndividu/@V',
"EtatCivil/Nom/@V", 'EtatCivil/Nom/@V',
"EtatCivil/NomJeuneFille/@V", 'EtatCivil/NomJeuneFille/@V',
"EtatCivil/Prenom/@V", 'EtatCivil/Prenom/@V',
"EtatCivil/DateNaissance/@V", 'EtatCivil/DateNaissance/@V',
"Dossier/Adresse/NumeroLieu/@V", 'Dossier/Adresse/NumeroLieu/@V',
"Dossier/Adresse/NatureLieu/@Lc", 'Dossier/Adresse/NatureLieu/@Lc',
"Dossier/Adresse/NomLieu/@V", 'Dossier/Adresse/NomLieu/@V',
"Dossier/Adresse/ComplementLieu/@V", 'Dossier/Adresse/ComplementLieu/@V',
"Dossier/Adresse/CpLieu/@V", 'Dossier/Adresse/CpLieu/@V',
"Dossier/Adresse/Commune/NomCom/@V", 'Dossier/Adresse/Commune/NomCom/@V',
], ],
} }
CONCILIATION_INDIVIDU_SANS_DN = { CONCILIATION_INDIVIDU_SANS_DN = {
'block': {'name': 'Individu', 'pk': "PK/IndexIndividu/@V"}, 'block': {'name': 'Individu', 'pk': 'PK/IndexIndividu/@V'},
'criteria': { 'criteria': {
5: ( 5: (
{ {
@ -103,23 +103,23 @@ CONCILIATION_INDIVIDU_SANS_DN = {
'EtatCivil/NomJeuneFille/@V': 'nom', 'EtatCivil/NomJeuneFille/@V': 'nom',
}, },
'output': [ 'output': [
"Dossier/PK/IndexDossier/@V", 'Dossier/PK/IndexDossier/@V',
"PK/IndexIndividu/@V", 'PK/IndexIndividu/@V',
"EtatCivil/Nom/@V", 'EtatCivil/Nom/@V',
"EtatCivil/NomJeuneFille/@V", 'EtatCivil/NomJeuneFille/@V',
"EtatCivil/Prenom/@V", 'EtatCivil/Prenom/@V',
"EtatCivil/DateNaissance/@V", 'EtatCivil/DateNaissance/@V',
"Dossier/Adresse/NumeroLieu/@V", 'Dossier/Adresse/NumeroLieu/@V',
"Dossier/Adresse/NatureLieu/@Lc", 'Dossier/Adresse/NatureLieu/@Lc',
"Dossier/Adresse/NomLieu/@V", 'Dossier/Adresse/NomLieu/@V',
"Dossier/Adresse/ComplementLieu/@V", 'Dossier/Adresse/ComplementLieu/@V',
"Dossier/Adresse/CpLieu/@V", 'Dossier/Adresse/CpLieu/@V',
"Dossier/Adresse/Commune/NomCom/@V", 'Dossier/Adresse/Commune/NomCom/@V',
], ],
} }
CONCILIATION_ADRESSE = { CONCILIATION_ADRESSE = {
'block': {'name': 'Adresse', 'pk': "CodeLieu/@V"}, 'block': {'name': 'Adresse', 'pk': 'CodeLieu/@V'},
'criteria': { 'criteria': {
5: ( 5: (
{ {
@ -135,18 +135,18 @@ CONCILIATION_ADRESSE = {
'Commune/PK/CodeCommune/@V': 'commune', 'Commune/PK/CodeCommune/@V': 'commune',
}, },
'output': [ 'output': [
"CodeLieu/@V", 'CodeLieu/@V',
"NatureLieu/@Lc", 'NatureLieu/@Lc',
"NomLieu/@V", 'NomLieu/@V',
"CodePostal/@V", 'CodePostal/@V',
"Commune/PK/CodeCommune/@V", 'Commune/PK/CodeCommune/@V',
"Commune/NomCom/@V", 'Commune/NomCom/@V',
"CodeDepartement/@V", 'CodeDepartement/@V',
], ],
} }
CONCILIATION_PARTICULIER = { CONCILIATION_PARTICULIER = {
'block': {'name': 'Particulier', 'pk': "PK/IndexParticulier/@V"}, 'block': {'name': 'Particulier', 'pk': 'PK/IndexParticulier/@V'},
'criteria': { 'criteria': {
5: ( 5: (
{ {
@ -177,23 +177,23 @@ CONCILIATION_PARTICULIER = {
'EtatCivil/NomJeuneFille/@V': 'nom', 'EtatCivil/NomJeuneFille/@V': 'nom',
}, },
'output': [ 'output': [
"PK/IndexParticulier/@V", 'PK/IndexParticulier/@V',
"EtatCivil/Nom/@V", 'EtatCivil/Nom/@V',
"EtatCivil/NomJeuneFille/@V", 'EtatCivil/NomJeuneFille/@V',
"EtatCivil/Prenom/@V", 'EtatCivil/Prenom/@V',
"EtatCivil/DateNaissance/@V", 'EtatCivil/DateNaissance/@V',
"Adresse/NumeroLieu/@V", 'Adresse/NumeroLieu/@V',
"Adresse/NatureLieu/@Lc", 'Adresse/NatureLieu/@Lc',
"Adresse/NomLieu/@V", 'Adresse/NomLieu/@V',
"Adresse/ComplementLieu/@V", 'Adresse/ComplementLieu/@V',
"Adresse/CpLieu/@V", 'Adresse/CpLieu/@V',
"Adresse/Commune/NomCom/@V", 'Adresse/Commune/NomCom/@V',
], ],
} }
def conciliation_payload(config, **data): def conciliation_payload(config, **data):
block = {"name": config['block']['name'], "PrimaryKey": {"key": [config['block']['pk']]}} block = {'name': config['block']['name'], 'PrimaryKey': {'key': [config['block']['pk']]}}
setting = [] setting = []
for affinity, afflist in config['criteria'].items(): for affinity, afflist in config['criteria'].items():
for aff in afflist: for aff in afflist:
@ -202,8 +202,8 @@ def conciliation_payload(config, **data):
criterium.append({'key': xpath, 'operator': op}) criterium.append({'key': xpath, 'operator': op})
setting.append( setting.append(
{ {
"affinity": affinity, 'affinity': affinity,
"Criterium": criterium, 'Criterium': criterium,
} }
) )
criterium = [] criterium = []
@ -214,16 +214,16 @@ def conciliation_payload(config, **data):
returndata.append(xpath) returndata.append(xpath)
return { return {
"ConciliationInputWS": { 'ConciliationInputWS': {
"Block": block, 'Block': block,
"Input": { 'Input': {
"Settings": { 'Settings': {
"Setting": setting, 'Setting': setting,
}, },
"Criteria": {"Criterium": criterium}, 'Criteria': {'Criterium': criterium},
}, },
"Output": { 'Output': {
"ReturnDatas": {"returnData": returndata}, 'ReturnDatas': {'returnData': returndata},
}, },
} }
} }

View File

@ -473,13 +473,13 @@ def get_info_bancaire(fields, wf):
banque_cle = wf.get('supp8_var_clerib') or fields.get('clerib') banque_cle = wf.get('supp8_var_clerib') or fields.get('clerib')
return { return {
"titulaireCompte": banque_titulaire, 'titulaireCompte': banque_titulaire,
"domiciliation": banque_domiciliation, 'domiciliation': banque_domiciliation,
"codeBanque": banque_codebanque, 'codeBanque': banque_codebanque,
"codeGuichet": banque_codeguichet, 'codeGuichet': banque_codeguichet,
"numeroCompte": banque_numero, 'numeroCompte': banque_numero,
"cleRib": banque_cle, 'cleRib': banque_cle,
"modeReglement": 1, 'modeReglement': 1,
} }
@ -524,36 +524,36 @@ def get_patrimoine(fields, wf):
if immobilier_bati > 0 and revenus_annee: if immobilier_bati > 0 and revenus_annee:
message.append( message.append(
{ {
"Nomenclature": {"indexFamille": 2, "indexNature": 1}, 'Nomenclature': {'indexFamille': 2, 'indexNature': 1},
"anneeReference": int(revenus_annee), 'anneeReference': int(revenus_annee),
"valeurPrelevement": immobilier_bati, 'valeurPrelevement': immobilier_bati,
} }
) )
if immobilier_non_bati > 0 and revenus_annee: if immobilier_non_bati > 0 and revenus_annee:
message.append( message.append(
{ {
"Nomenclature": {"indexFamille": 2, "indexNature": 2}, 'Nomenclature': {'indexFamille': 2, 'indexNature': 2},
"anneeReference": int(revenus_annee), 'anneeReference': int(revenus_annee),
"valeurPrelevement": immobilier_non_bati, 'valeurPrelevement': immobilier_non_bati,
} }
) )
if prelevements > 0 and revenus_annee: if prelevements > 0 and revenus_annee:
message.append( message.append(
{ {
"Nomenclature": {"indexFamille": 3, "indexNature": 1}, 'Nomenclature': {'indexFamille': 3, 'indexNature': 1},
"anneeReference": int(revenus_annee), 'anneeReference': int(revenus_annee),
"valeurPrelevement": prelevements, 'valeurPrelevement': prelevements,
} }
) )
if fonciers > 0 and fonciers_annee: if fonciers > 0 and fonciers_annee:
message.append( message.append(
{ {
"Nomenclature": {"indexFamille": 4, "indexNature": 1}, 'Nomenclature': {'indexFamille': 4, 'indexNature': 1},
"anneeReference": int(fonciers_annee), 'anneeReference': int(fonciers_annee),
"valeurPrelevement": fonciers, 'valeurPrelevement': fonciers,
} }
) )

View File

@ -87,11 +87,11 @@ class SolisAPA(BaseResource):
data['ReferentialOptions']['Filters'] = {'Filter': solis_filters} data['ReferentialOptions']['Filters'] = {'Filter': solis_filters}
if attributes: if attributes:
data['ReferentialOptions']['Attributes'] = { data['ReferentialOptions']['Attributes'] = {
"referential": [ 'referential': [
{ {
"schema": "stdr", 'schema': 'stdr',
"table": referential, 'table': referential,
"field": attributes, 'field': attributes,
} }
] ]
} }

View File

@ -18,16 +18,16 @@ import datetime
import json import json
PAYLOAD = { PAYLOAD = {
"visite": {}, 'visite': {},
"plan-aide": {"DemandeAsg": {"DateDebut": "%(datedebut)s", "DateFin": "%(datefin)s"}}, 'plan-aide': {'DemandeAsg': {'DateDebut': '%(datedebut)s', 'DateFin': '%(datefin)s'}},
"presentation-commission": {"OrdreJourAsg": {"DateDebut": "%(datedebut)s", "DateFin": "%(datefin)s"}}, 'presentation-commission': {'OrdreJourAsg': {'DateDebut': '%(datedebut)s', 'DateFin': '%(datefin)s'}},
"decision-commission": { 'decision-commission': {
"DemandeAsg": { 'DemandeAsg': {
"EtatDecision": "R", 'EtatDecision': 'R',
"DateDebutNotification": "%(datedebut)s", 'DateDebutNotification': '%(datedebut)s',
"DateFinNotification": "%(datefin)s", 'DateFinNotification': '%(datefin)s',
"DateDebutDecision": "%(datedebut)s", 'DateDebutDecision': '%(datedebut)s',
"DateFinDecision": "%(datefin)s", 'DateFinDecision': '%(datefin)s',
} }
}, },
} }

View File

@ -131,7 +131,7 @@ class ToulouseAxel(BaseResource):
cache.set(cache_key, management_dates, 3600) # 1 hour cache.set(cache_key, management_dates, 3600) # 1 hour
return management_dates return management_dates
@endpoint(display_order=4, description=_("Get dates of the update management")) @endpoint(display_order=4, description=_('Get dates of the update management'))
def management_dates(self, request): def management_dates(self, request):
return {'data': self.get_management_dates()} return {'data': self.get_management_dates()}
@ -219,7 +219,7 @@ class ToulouseAxel(BaseResource):
@endpoint( @endpoint(
display_category='DUI', display_category='DUI',
display_order=3, display_order=3,
description=_("Check DUI status"), description=_('Check DUI status'),
parameters={ parameters={
'NameID': {'description': _('Publik ID')}, 'NameID': {'description': _('Publik ID')},
}, },
@ -262,7 +262,7 @@ class ToulouseAxel(BaseResource):
@endpoint( @endpoint(
display_order=5, display_order=5,
description=_("Get a referential"), description=_('Get a referential'),
pattern=r'^(?P<code>[\w-]+)/?$', pattern=r'^(?P<code>[\w-]+)/?$',
example_pattern='{code}', example_pattern='{code}',
parameters={ parameters={
@ -353,7 +353,7 @@ class ToulouseAxel(BaseResource):
@endpoint( @endpoint(
display_category='DUI', display_category='DUI',
display_order=5, display_order=5,
description=_("Get information about children"), description=_('Get information about children'),
parameters={ parameters={
'NameID': {'description': _('Publik ID')}, 'NameID': {'description': _('Publik ID')},
}, },
@ -366,7 +366,7 @@ class ToulouseAxel(BaseResource):
@endpoint( @endpoint(
display_category='DUI', display_category='DUI',
display_order=6, display_order=6,
description=_("Get information about a child"), description=_('Get information about a child'),
parameters={ parameters={
'NameID': {'description': _('Publik ID')}, 'NameID': {'description': _('Publik ID')},
'idpersonne': {'description': _('Child ID')}, 'idpersonne': {'description': _('Child ID')},
@ -404,7 +404,7 @@ class ToulouseAxel(BaseResource):
@endpoint( @endpoint(
display_category='DUI', display_category='DUI',
display_order=7, display_order=7,
description=_("Get information about children contacts"), description=_('Get information about children contacts'),
parameters={ parameters={
'NameID': {'description': _('Publik ID')}, 'NameID': {'description': _('Publik ID')},
}, },
@ -731,7 +731,7 @@ class ToulouseAxel(BaseResource):
name='regie', name='regie',
pattern=r'^(?P<regie_id>[\w-]+)/invoices/?$', pattern=r'^(?P<regie_id>[\w-]+)/invoices/?$',
example_pattern='{regie_id}/invoices', example_pattern='{regie_id}/invoices',
description=_("Get invoices to pay"), description=_('Get invoices to pay'),
parameters={ parameters={
'NameID': {'description': _('Publik ID'), 'blank': False}, 'NameID': {'description': _('Publik ID'), 'blank': False},
'regie_id': {'description': _('Regie identifier'), 'example_value': '42-PERISCOL'}, 'regie_id': {'description': _('Regie identifier'), 'example_value': '42-PERISCOL'},
@ -747,7 +747,7 @@ class ToulouseAxel(BaseResource):
name='regie', name='regie',
pattern=r'^(?P<regie_id>[\w-]+)/invoices/history/?$', pattern=r'^(?P<regie_id>[\w-]+)/invoices/history/?$',
example_pattern='{regie_id}/invoices/history', example_pattern='{regie_id}/invoices/history',
description=_("Get invoices already paid"), description=_('Get invoices already paid'),
parameters={ parameters={
'NameID': {'description': _('Publik ID'), 'blank': False}, 'NameID': {'description': _('Publik ID'), 'blank': False},
'regie_id': {'description': _('Regie identifier'), 'example_value': '42-PERISCOL'}, 'regie_id': {'description': _('Regie identifier'), 'example_value': '42-PERISCOL'},
@ -1046,7 +1046,7 @@ class ToulouseAxel(BaseResource):
@endpoint( @endpoint(
display_category='CAN-CLA', display_category='CAN-CLA',
display_order=1, display_order=1,
description=_("Get the list of reference years available for bookings"), description=_('Get the list of reference years available for bookings'),
parameters={ parameters={
'NameID': {'description': _('Publik ID')}, 'NameID': {'description': _('Publik ID')},
'pivot_date': { 'pivot_date': {
@ -1106,7 +1106,7 @@ class ToulouseAxel(BaseResource):
@endpoint( @endpoint(
display_category='CAN-CLA', display_category='CAN-CLA',
display_order=2, display_order=2,
description=_("Get information about CLAE activities of all children for the year"), description=_('Get information about CLAE activities of all children for the year'),
parameters={ parameters={
'NameID': {'description': _('Publik ID')}, 'NameID': {'description': _('Publik ID')},
'booking_date': {'description': _('Booking date (to get reference year)')}, 'booking_date': {'description': _('Booking date (to get reference year)')},
@ -1129,7 +1129,7 @@ class ToulouseAxel(BaseResource):
@endpoint( @endpoint(
display_category='CAN-CLA', display_category='CAN-CLA',
display_order=3, display_order=3,
description=_("Get the list of CLAE booked activities of a child, for a period"), description=_('Get the list of CLAE booked activities of a child, for a period'),
parameters={ parameters={
'NameID': {'description': _('Publik ID')}, 'NameID': {'description': _('Publik ID')},
'idpersonne': {'description': _('Child ID')}, 'idpersonne': {'description': _('Child ID')},
@ -1206,7 +1206,7 @@ class ToulouseAxel(BaseResource):
@endpoint( @endpoint(
display_category='CAN-CLA', display_category='CAN-CLA',
display_order=4, display_order=4,
description=_("Get possible days to book an activity of a child, for a period"), description=_('Get possible days to book an activity of a child, for a period'),
parameters={ parameters={
'NameID': {'description': _('Publik ID')}, 'NameID': {'description': _('Publik ID')},
'idpersonne': {'description': _('Child ID')}, 'idpersonne': {'description': _('Child ID')},
@ -1292,7 +1292,7 @@ class ToulouseAxel(BaseResource):
@endpoint( @endpoint(
display_category='CAN-CLA', display_category='CAN-CLA',
display_order=5, display_order=5,
description=_("Get annual possible days to book an activity of a child"), description=_('Get annual possible days to book an activity of a child'),
parameters={ parameters={
'NameID': {'description': _('Publik ID')}, 'NameID': {'description': _('Publik ID')},
'idpersonne': {'description': _('Child ID')}, 'idpersonne': {'description': _('Child ID')},
@ -1347,7 +1347,7 @@ class ToulouseAxel(BaseResource):
@endpoint( @endpoint(
display_category='CAN-CLA', display_category='CAN-CLA',
display_order=6, display_order=6,
description=_("Get booked days for an activity of a child, for a period"), description=_('Get booked days for an activity of a child, for a period'),
parameters={ parameters={
'NameID': {'description': _('Publik ID')}, 'NameID': {'description': _('Publik ID')},
'idpersonne': {'description': _('Child ID')}, 'idpersonne': {'description': _('Child ID')},
@ -1365,7 +1365,7 @@ class ToulouseAxel(BaseResource):
@endpoint( @endpoint(
display_category='CAN-CLA', display_category='CAN-CLA',
display_order=7, display_order=7,
description=_("CLAE/Cantine booking"), description=_('CLAE/Cantine booking'),
parameters={ parameters={
'NameID': {'description': _('Publik ID')}, 'NameID': {'description': _('Publik ID')},
}, },
@ -1516,7 +1516,7 @@ class ToulouseAxel(BaseResource):
@endpoint( @endpoint(
display_category='CAN-CLA', display_category='CAN-CLA',
display_order=8, display_order=8,
description=_("CLAE/Cantine annual booking"), description=_('CLAE/Cantine annual booking'),
parameters={ parameters={
'NameID': {'description': _('Publik ID')}, 'NameID': {'description': _('Publik ID')},
}, },

View File

@ -58,15 +58,15 @@ ATTACHMENT_SCHEMA = {
'required': ['filename', 'content_type', 'content'], 'required': ['filename', 'content_type', 'content'],
'properties': { 'properties': {
'filename': { 'filename': {
'description': _("File name"), 'description': _('File name'),
'type': 'string', 'type': 'string',
}, },
'content_type': { 'content_type': {
'description': _("MIME type"), 'description': _('MIME type'),
'type': 'string', 'type': 'string',
}, },
'content': { 'content': {
'description': _("Content"), 'description': _('Content'),
'type': 'string', 'type': 'string',
}, },
}, },
@ -567,10 +567,10 @@ class Resource(BaseResource, HTTPResource):
return HttpResponse(fd, content_type='application/pdf') return HttpResponse(fd, content_type='application/pdf')
@endpoint( @endpoint(
name="create-application", name='create-application',
post={ post={
"description": _("Creates an application"), 'description': _('Creates an application'),
"request_body": {"schema": {"application/json": APPLICATION_SCHEMA}}, 'request_body': {'schema': {'application/json': APPLICATION_SCHEMA}},
}, },
) )
def create_application(self, request, post_data): def create_application(self, request, post_data):
@ -642,22 +642,22 @@ class Resource(BaseResource, HTTPResource):
@endpoint( @endpoint(
name='attach-file', name='attach-file',
post={ post={
"description": _("Attach a file to an application."), 'description': _('Attach a file to an application.'),
"request_body": {"schema": {"application/json": ATTACHMENT_SCHEMA}}, 'request_body': {'schema': {'application/json': ATTACHMENT_SCHEMA}},
}, },
) )
def attach_file(self, request, post_data): def attach_file(self, request, post_data):
application_id = post_data["application_id"] application_id = post_data['application_id']
attachment_name = post_data["name"] attachment_name = post_data['name']
file = post_data["file"] file = post_data['file']
self.http_request( self.http_request(
'POST', 'POST',
f'data/candidature/{application_id}/fields/{attachment_name}?viewIntegrationName=api_publik', f'data/candidature/{application_id}/fields/{attachment_name}?viewIntegrationName=api_publik',
json={ json={
"contentType": file["content_type"], 'contentType': file['content_type'],
"value": file["content"], 'value': file['content'],
"fileName": file["filename"], 'fileName': file['filename'],
}, },
) )

View File

@ -183,7 +183,7 @@ SUBSCRIPTION_SCHEMA = {
}, },
}, },
'form_api_url': { 'form_api_url': {
'description': "Adresse de la vue API du formulaire Publik : {{ form_api_url }}", 'description': 'Adresse de la vue API du formulaire Publik : {{ form_api_url }}',
'oneOf': [ 'oneOf': [
{'type': 'string'}, {'type': 'string'},
{'type': 'null'}, {'type': 'null'},

View File

@ -115,7 +115,7 @@ AUTHORIZED_PERSON_SCHEMA = {
BIRTH_SCHEMA = { BIRTH_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#', '$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'Birth info', 'title': 'Birth info',
'description': "Informations relatives à la naissance", 'description': 'Informations relatives à la naissance',
'type': 'object', 'type': 'object',
'required': ['dateBirth'], 'required': ['dateBirth'],
'properties': { 'properties': {
@ -156,7 +156,7 @@ INDICATOR_SCHEMA = {
'pattern': '.+', 'pattern': '.+',
}, },
'note': { 'note': {
'description': "Commentaire pour les indicateurs de type NOTE", 'description': 'Commentaire pour les indicateurs de type NOTE',
'oneOf': [{'type': 'string'}, {'type': 'null'}], 'oneOf': [{'type': 'string'}, {'type': 'null'}],
}, },
'isActive': { 'isActive': {
@ -176,7 +176,7 @@ ID_PROPERTIES = {
'type': 'string', 'type': 'string',
}, },
'maidenName': { 'maidenName': {
'description': "Nom de jeune fille ", 'description': 'Nom de jeune fille ',
'oneOf': [{'type': 'string'}, {'type': 'null'}], 'oneOf': [{'type': 'string'}, {'type': 'null'}],
}, },
'birth': BIRTH_SCHEMA, 'birth': BIRTH_SCHEMA,
@ -305,7 +305,7 @@ PROFESSION_SCHEMA = {
'oneOf': [{'type': 'string'}, {'type': 'null'}], 'oneOf': [{'type': 'string'}, {'type': 'null'}],
}, },
'weeklyHours': { 'weeklyHours': {
'description': "horaires de travail hebdomadaire", 'description': 'horaires de travail hebdomadaire',
'oneOf': [{'type': 'string'}, {'type': 'null'}], 'oneOf': [{'type': 'string'}, {'type': 'null'}],
}, },
'addressPro': ADDRESSPROF_SCHEMA, 'addressPro': ADDRESSPROF_SCHEMA,
@ -332,7 +332,7 @@ CAFINFO_SCHEMA = {
RLINFO_SCHEMA = { RLINFO_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#', '$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'RL', 'title': 'RL',
'description': "Informations sur le responsable légal", 'description': 'Informations sur le responsable légal',
'type': 'object', 'type': 'object',
'required': ['firstname', 'lastname', 'civility', 'quality', 'birth', 'adresse'], 'required': ['firstname', 'lastname', 'civility', 'quality', 'birth', 'adresse'],
'properties': { 'properties': {
@ -389,7 +389,7 @@ DOCTORADDRESS_SCHEMA = {
FAMILYDOCTOR_SCHEMA = { FAMILYDOCTOR_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#', '$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'Family doctor', 'title': 'Family doctor',
'description': "Informations sur le docteur", 'description': 'Informations sur le docteur',
'type': 'object', 'type': 'object',
'properties': { 'properties': {
'name': { 'name': {
@ -407,7 +407,7 @@ FAMILYDOCTOR_SCHEMA = {
VACCIN_SCHEMA = { VACCIN_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#', '$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'Vaccin', 'title': 'Vaccin',
'description': "Informations sur le vaccin", 'description': 'Informations sur le vaccin',
'type': 'object', 'type': 'object',
'required': ['code', 'vaccinationDate'], 'required': ['code', 'vaccinationDate'],
'properties': { 'properties': {
@ -426,7 +426,7 @@ VACCIN_SCHEMA = {
MEDICALRECORD_SCHEMA = { MEDICALRECORD_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#', '$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'Medical record', 'title': 'Medical record',
'description': "Informations médicales", 'description': 'Informations médicales',
'oneOf': [ 'oneOf': [
{ {
'type': 'object', 'type': 'object',
@ -484,7 +484,7 @@ MEDICALRECORD_SCHEMA = {
PAIINFO_SCHEMA = { PAIINFO_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#', '$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'PAI', 'title': 'PAI',
'description': "Informations médicales", 'description': 'Informations médicales',
'type': 'object', 'type': 'object',
'required': ['code'], 'required': ['code'],
'properties': { 'properties': {
@ -724,7 +724,7 @@ UPDATE_INDICATOR_SCHEMA = {
UPDATE_QUOTIENT_SCHEMA = { UPDATE_QUOTIENT_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#', '$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'Family persons', 'title': 'Family persons',
'description': "Mise à jours des quotients sur les responsables légaux", 'description': 'Mise à jours des quotients sur les responsables légaux',
'type': 'object', 'type': 'object',
'required': ['yearRev', 'dateStart', 'dateEnd', 'mtt', 'cdquo'], 'required': ['yearRev', 'dateStart', 'dateEnd', 'mtt', 'cdquo'],
'properties': { 'properties': {
@ -765,15 +765,15 @@ WCS_FILE_SCHEMA = {
'required': ['filename', 'content_type', 'content'], 'required': ['filename', 'content_type', 'content'],
'properties': { 'properties': {
'filename': { 'filename': {
'description': "Nom du ficher", 'description': 'Nom du ficher',
'type': 'string', 'type': 'string',
}, },
'content_type': { 'content_type': {
'description': "Type MIME", 'description': 'Type MIME',
'type': 'string', 'type': 'string',
}, },
'content': { 'content': {
'description': "Contenu", 'description': 'Contenu',
'type': 'string', 'type': 'string',
}, },
}, },
@ -840,7 +840,7 @@ SCHOOL_PRE_REGISTRATION_SCHEMA = {
'type': 'string', 'type': 'string',
}, },
'schoolYear': { 'schoolYear': {
'description': "Année scolaire", 'description': 'Année scolaire',
'type': 'string', 'type': 'string',
}, },
'dateSubscribe': { 'dateSubscribe': {
@ -848,7 +848,7 @@ SCHOOL_PRE_REGISTRATION_SCHEMA = {
'type': 'string', 'type': 'string',
}, },
'levelCode': { 'levelCode': {
'description': "Le code du niveau scolaire", 'description': 'Le code du niveau scolaire',
'type': 'string', 'type': 'string',
}, },
}, },
@ -876,7 +876,7 @@ SCHOOL_PRE_REGISTRATION_WITH_EXEMPTION_SCHEMA = {
'type': 'string', 'type': 'string',
}, },
'schoolYear': { 'schoolYear': {
'description': "Année scolaire", 'description': 'Année scolaire',
'type': 'string', 'type': 'string',
}, },
'datePresubscribe': { 'datePresubscribe': {
@ -884,7 +884,7 @@ SCHOOL_PRE_REGISTRATION_WITH_EXEMPTION_SCHEMA = {
'type': 'string', 'type': 'string',
}, },
'levelCode': { 'levelCode': {
'description': "Le code du niveau scolaire", 'description': 'Le code du niveau scolaire',
'type': 'string', 'type': 'string',
}, },
'idRequestSchool1': { 'idRequestSchool1': {
@ -900,11 +900,11 @@ SCHOOL_PRE_REGISTRATION_WITH_EXEMPTION_SCHEMA = {
'type': 'string', 'type': 'string',
}, },
'derogReasonCode': { 'derogReasonCode': {
'description': "Code du motif de dérogation", 'description': 'Code du motif de dérogation',
'type': 'string', 'type': 'string',
}, },
'derogComment': { 'derogComment': {
'description': "Commentaire relatif à la dérogation", 'description': 'Commentaire relatif à la dérogation',
'type': 'string', 'type': 'string',
}, },
}, },
@ -932,7 +932,7 @@ SCHOOL_PRE_REGISTRATION_WITH_SIBLING_SCHEMA = {
'type': 'string', 'type': 'string',
}, },
'schoolYear': { 'schoolYear': {
'description': "Année scolaire", 'description': 'Année scolaire',
'type': 'string', 'type': 'string',
}, },
'datePresubscribe': { 'datePresubscribe': {
@ -940,7 +940,7 @@ SCHOOL_PRE_REGISTRATION_WITH_SIBLING_SCHEMA = {
'type': 'string', 'type': 'string',
}, },
'levelCode': { 'levelCode': {
'description': "Le code du niveau scolaire", 'description': 'Le code du niveau scolaire',
'type': 'string', 'type': 'string',
}, },
'idSchoolRequested': { 'idSchoolRequested': {
@ -948,7 +948,7 @@ SCHOOL_PRE_REGISTRATION_WITH_SIBLING_SCHEMA = {
'type': 'string', 'type': 'string',
}, },
'numPersonSibling': { 'numPersonSibling': {
'description': "Identifiant du membre de la fratrie pour lequel le rapprochement est demandé", 'description': 'Identifiant du membre de la fratrie pour lequel le rapprochement est demandé',
'type': 'string', 'type': 'string',
}, },
}, },

View File

@ -17,7 +17,7 @@
PERSON_BANK_SCHEMA = { PERSON_BANK_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#', '$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'Person bank', 'title': 'Person bank',
'description': "Coordonnées du compte à débiter (coordonnées bancaires)", 'description': 'Coordonnées du compte à débiter (coordonnées bancaires)',
'type': 'object', 'type': 'object',
'required': ['bankBIC', 'bankIBAN', 'bankRUM', 'dateStart', 'bankAddress', 'lastName', 'firstName'], 'required': ['bankBIC', 'bankIBAN', 'bankRUM', 'dateStart', 'bankAddress', 'lastName', 'firstName'],
'properties': { 'properties': {

View File

@ -89,7 +89,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
) )
max_payment_delay = models.PositiveIntegerField( max_payment_delay = models.PositiveIntegerField(
default='20', default='20',
verbose_name="Délai maximum pour payer une facture via Lingo (en minutes)", verbose_name='Délai maximum pour payer une facture via Lingo (en minutes)',
) )
category = 'Connecteurs métiers' category = 'Connecteurs métiers'
@ -538,13 +538,13 @@ class ToulouseMaelis(BaseResource, HTTPResource):
def assert_key_in_referential(self, referential_name, key_value, keys_text, required=True): def assert_key_in_referential(self, referential_name, key_value, keys_text, required=True):
if not key_value: if not key_value:
if required: if required:
raise APIError("%s is required and could not be None" % keys_text) raise APIError('%s is required and could not be None' % keys_text)
return return
try: try:
self.referential.get(referential_name=referential_name, item_id=key_value) self.referential.get(referential_name=referential_name, item_id=key_value)
except Referential.DoesNotExist: except Referential.DoesNotExist:
ref_text = "required " if required else "" ref_text = 'required ' if required else ''
ref_text = ref_text + "referential" ref_text = ref_text + 'referential'
raise APIError( raise APIError(
"%s key value '%s' do not belong to '%s' %s" "%s key value '%s' do not belong to '%s' %s"
% (keys_text, key_value, referential_name, ref_text) % (keys_text, key_value, referential_name, ref_text)
@ -993,7 +993,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Famille', display_category='Famille',
description="Lister les situations professionnelles", description='Lister les situations professionnelles',
name='read-professional-situation-list', name='read-professional-situation-list',
parameters={ parameters={
'id': {'description': 'Identifiant de lenregistrement'}, 'id': {'description': 'Identifiant de lenregistrement'},
@ -1141,7 +1141,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Famille', display_category='Famille',
description="Rechercher un dossier famille", description='Rechercher un dossier famille',
name='search-family', name='search-family',
parameters={ parameters={
'q': {'description': 'Recherche en texte intégral'}, 'q': {'description': 'Recherche en texte intégral'},
@ -1164,7 +1164,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Famille', display_category='Famille',
description="Rechercher un dossier famille par son numéro de DUI", description='Rechercher un dossier famille par son numéro de DUI',
name='search-family-dui', name='search-family-dui',
parameters={ parameters={
'q': {'description': 'Numéro de DUI'}, 'q': {'description': 'Numéro de DUI'},
@ -1199,7 +1199,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Famille', display_category='Famille',
description="Lister les responsables légaux", description='Lister les responsables légaux',
name='read-rl-list', name='read-rl-list',
parameters={ parameters={
'NameID': {'description': 'Publik NameID'}, 'NameID': {'description': 'Publik NameID'},
@ -1245,7 +1245,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Famille', display_category='Famille',
description="Lister les enfants", description='Lister les enfants',
name='read-child-list', name='read-child-list',
parameters={ parameters={
'NameID': {'description': 'Publik NameID'}, 'NameID': {'description': 'Publik NameID'},
@ -1262,7 +1262,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Famille', display_category='Famille',
description="Lister les enfants et les responsables légaux", description='Lister les enfants et les responsables légaux',
name='read-rl-and-child-list', name='read-rl-and-child-list',
parameters={ parameters={
'NameID': {'description': 'Publik NameID'}, 'NameID': {'description': 'Publik NameID'},
@ -1317,7 +1317,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Famille', display_category='Famille',
description="Obtenir les informations sur un responsable légal", description='Obtenir les informations sur un responsable légal',
name='read-rl', name='read-rl',
parameters={ parameters={
'rl_id': {'description': 'Numéro du responsable légal'}, 'rl_id': {'description': 'Numéro du responsable légal'},
@ -1357,7 +1357,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Famille', display_category='Famille',
description="Obtenir les informations sur un enfant", description='Obtenir les informations sur un enfant',
name='read-child', name='read-child',
parameters={ parameters={
'child_id': {'description': "Numéro de l'enfant"}, 'child_id': {'description': "Numéro de l'enfant"},
@ -1410,17 +1410,17 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Famille', display_category='Famille',
description="Lister les activités auxquelles un RL ou un enfant est inscrit", description='Lister les activités auxquelles un RL ou un enfant est inscrit',
name='read-subscribe-activity-list', name='read-subscribe-activity-list',
parameters={ parameters={
'person_id': {'description': "Numéro du responsable légal ou de l'enfant"}, 'person_id': {'description': "Numéro du responsable légal ou de l'enfant"},
'NameID': {'description': 'Publik NameID'}, 'NameID': {'description': 'Publik NameID'},
'family_id': {'description': 'Numéro de DUI'}, 'family_id': {'description': 'Numéro de DUI'},
'nature': { 'nature': {
'description': "Natures des activités : PERICSO, EXTRASCO ou LOISIR (toutes par défaut)", 'description': 'Natures des activités : PERICSO, EXTRASCO ou LOISIR (toutes par défaut)',
}, },
'type_ids': { 'type_ids': {
'description': "Codes des types des activités (tous par défaut), séparés par des virgules", 'description': 'Codes des types des activités (tous par défaut), séparés par des virgules',
'example_value': 'ACCSOIR,RESTSCOL', 'example_value': 'ACCSOIR,RESTSCOL',
}, },
'school_year': { 'school_year': {
@ -1636,7 +1636,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Famille', display_category='Famille',
description="Ajouter un enfant", description='Ajouter un enfant',
name='create-child', name='create-child',
parameters={ parameters={
'NameID': {'description': 'Publik NameID'}, 'NameID': {'description': 'Publik NameID'},
@ -1667,7 +1667,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Famille', display_category='Famille',
description="Modifier un enfant", description='Modifier un enfant',
name='update-child', name='update-child',
parameters={ parameters={
'child_id': {'description': "Numéro de l'enfant"}, 'child_id': {'description': "Numéro de l'enfant"},
@ -1744,7 +1744,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
description="Créer ou mettre à jour le quotient d'un responsable légal", description="Créer ou mettre à jour le quotient d'un responsable légal",
name='update-quotient', name='update-quotient',
parameters={ parameters={
'rl_id': {'description': "Numéro du responsable légal"}, 'rl_id': {'description': 'Numéro du responsable légal'},
'NameID': {'description': 'Publik NameID'}, 'NameID': {'description': 'Publik NameID'},
'family_id': {'description': 'Numéro de DUI'}, 'family_id': {'description': 'Numéro de DUI'},
}, },
@ -2024,7 +2024,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Famille', display_category='Famille',
description="Ajouter une vaccination à un enfant", description='Ajouter une vaccination à un enfant',
name='update-child-add-vaccination', name='update-child-add-vaccination',
parameters={ parameters={
'child_id': {'description': "Numéro de l'enfant"}, 'child_id': {'description': "Numéro de l'enfant"},
@ -2093,7 +2093,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Famille', display_category='Famille',
description="Savoir si un document déjà ajouté est encore valable", description='Savoir si un document déjà ajouté est encore valable',
name='read-supplied-document-validity', name='read-supplied-document-validity',
parameters={ parameters={
'NameID': {'description': 'Publik NameID'}, 'NameID': {'description': 'Publik NameID'},
@ -2101,7 +2101,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
'numPerson': {'description': "Numéro du responsable légal ou de l'enfant"}, 'numPerson': {'description': "Numéro du responsable légal ou de l'enfant"},
'code': {'description': 'Code de la pièce'}, 'code': {'description': 'Code de la pièce'},
'ref_date': { 'ref_date': {
'description': "Date de référence, utilisée pour déduire la validité", 'description': 'Date de référence, utilisée pour déduire la validité',
'type': 'date', 'type': 'date',
}, },
}, },
@ -2475,7 +2475,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Facture', display_category='Facture',
description="Ajouter une autorisation de prélèvement", description='Ajouter une autorisation de prélèvement',
name='add-rl1-direct-debit-order', name='add-rl1-direct-debit-order',
parameters={ parameters={
'NameID': {'description': 'Publik NameID'}, 'NameID': {'description': 'Publik NameID'},
@ -2522,7 +2522,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Inscriptions', display_category='Inscriptions',
description="Lister les années scolaires", description='Lister les années scolaires',
name='read-school-years-list', name='read-school-years-list',
) )
def read_school_years_list(self, request): def read_school_years_list(self, request):
@ -2530,7 +2530,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Inscriptions', display_category='Inscriptions',
description="Lister les niveaux scolaires", description='Lister les niveaux scolaires',
name='read-school-levels-list', name='read-school-levels-list',
parameters={ parameters={
'age': {'description': 'Âge de l\'enfant', 'example_value': '6'}, 'age': {'description': 'Âge de l\'enfant', 'example_value': '6'},
@ -2544,7 +2544,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Inscriptions', display_category='Inscriptions',
description="Lister les motifs de dérogation", description='Lister les motifs de dérogation',
name='read-exemption-reasons-list', name='read-exemption-reasons-list',
) )
def read_exemption_reasons_list(self, request): def read_exemption_reasons_list(self, request):
@ -2552,7 +2552,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Inscriptions', display_category='Inscriptions',
description="Lister les écoles pour une adresse et niveau scolaire", description='Lister les écoles pour une adresse et niveau scolaire',
name='read-schools-for-address-and-level', name='read-schools-for-address-and-level',
parameters={ parameters={
'year': {'description': 'Année', 'example_value': '2022'}, 'year': {'description': 'Année', 'example_value': '2022'},
@ -2580,7 +2580,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Inscriptions', display_category='Inscriptions',
description="Lister les écoles pour un enfant et niveau scolaire", description='Lister les écoles pour un enfant et niveau scolaire',
name='read-schools-for-child-and-level', name='read-schools-for-child-and-level',
parameters={ parameters={
'year': {'description': 'Année', 'example_value': '2023'}, 'year': {'description': 'Année', 'example_value': '2023'},
@ -2634,7 +2634,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Inscriptions', display_category='Inscriptions',
description="Créer une pré-inscription scolaire pour un enfant", description='Créer une pré-inscription scolaire pour un enfant',
name='create-child-school-pre-registration', name='create-child-school-pre-registration',
post={ post={
'request_body': {'schema': {'application/json': family_schemas.SCHOOL_PRE_REGISTRATION_SCHEMA}} 'request_body': {'schema': {'application/json': family_schemas.SCHOOL_PRE_REGISTRATION_SCHEMA}}
@ -2646,7 +2646,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Inscriptions', display_category='Inscriptions',
description="Créer une pré-inscription scolaire avec demande de dérogation", description='Créer une pré-inscription scolaire avec demande de dérogation',
name='create-child-school-pre-registration-with-exemption', name='create-child-school-pre-registration-with-exemption',
post={ post={
'request_body': { 'request_body': {
@ -2660,7 +2660,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Inscriptions', display_category='Inscriptions',
description="Créer une pré-inscription scolaire avec rapprochement de fratrie", description='Créer une pré-inscription scolaire avec rapprochement de fratrie',
name='create-child-school-pre-registration-with-sibling', name='create-child-school-pre-registration-with-sibling',
post={ post={
'request_body': { 'request_body': {
@ -2674,7 +2674,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Inscriptions', display_category='Inscriptions',
description="Obtenir le catalogue des activités loisir, avec leurs critères de recherche", description='Obtenir le catalogue des activités loisir, avec leurs critères de recherche',
name='read-activity-list', name='read-activity-list',
parameters={ parameters={
'ref_date': { 'ref_date': {
@ -2802,16 +2802,16 @@ class ToulouseMaelis(BaseResource, HTTPResource):
parameters={ parameters={
'person_id': {'description': "Numéro du responsable légal ou de l'enfant"}, 'person_id': {'description': "Numéro du responsable légal ou de l'enfant"},
'nature': { 'nature': {
'description': "Nature des activités : EXTRASCO ou LOISIR (toutes par défaut)", 'description': 'Nature des activités : EXTRASCO ou LOISIR (toutes par défaut)',
}, },
'type_ids': { 'type_ids': {
'description': "Codes des types des activités, séparées par des virgules", 'description': 'Codes des types des activités, séparées par des virgules',
'example_value': 'EXTMERC,EXTVAC', 'example_value': 'EXTMERC,EXTVAC',
}, },
'start_date': {'description': 'Début de la période'}, 'start_date': {'description': 'Début de la période'},
'end_date': {'description': 'Fin de la période'}, 'end_date': {'description': 'Fin de la période'},
'text_template': { 'text_template': {
'description': "Gabarit utilisé pour la valeur text (URL encoding)", 'description': 'Gabarit utilisé pour la valeur text (URL encoding)',
'example_value': '{{ activity.libelle2 }}', 'example_value': '{{ activity.libelle2 }}',
}, },
}, },
@ -2975,24 +2975,24 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Inscriptions', display_category='Inscriptions',
description="Obtenir le catalogue geojson des activités pour une personne", description='Obtenir le catalogue geojson des activités pour une personne',
name='get-person-catalog-geojson', name='get-person-catalog-geojson',
parameters={ parameters={
'NameID': {'description': 'Publik NameID'}, 'NameID': {'description': 'Publik NameID'},
'family_id': {'description': 'Numéro de DUI'}, 'family_id': {'description': 'Numéro de DUI'},
'person_id': {'description': "Numéro du responsable légal ou de l'enfant"}, 'person_id': {'description': "Numéro du responsable légal ou de l'enfant"},
'nature': { 'nature': {
'description': "Nature des activités : EXTRASCO ou LOISIR (toutes par défaut)", 'description': 'Nature des activités : EXTRASCO ou LOISIR (toutes par défaut)',
}, },
'type_ids': { 'type_ids': {
'description': "Codes des types des activités, séparées par des virgules", 'description': 'Codes des types des activités, séparées par des virgules',
'example_value': 'EXTMERC,EXTVAC', 'example_value': 'EXTMERC,EXTVAC',
}, },
'start_date': {'description': 'Début de la période'}, 'start_date': {'description': 'Début de la période'},
'end_date': {'description': 'Fin de la période'}, 'end_date': {'description': 'Fin de la période'},
'activity_id': {'description': "Numéro de l'activité"}, 'activity_id': {'description': "Numéro de l'activité"},
'unit_id': {'description': "Numéro de l'unité"}, 'unit_id': {'description': "Numéro de l'unité"},
'place_id': {'description': "Numéro du lieu"}, 'place_id': {'description': 'Numéro du lieu'},
}, },
) )
def get_person_catalog_geojson( def get_person_catalog_geojson(
@ -3096,11 +3096,11 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Inscriptions', display_category='Inscriptions',
description="Lister les natures des activités", description='Lister les natures des activités',
name='read-activity-nature-list', name='read-activity-nature-list',
parameters={ parameters={
'nature_ids': { 'nature_ids': {
'description': "Codes des natures des activités (tous par défaut), séparées par des virgules", 'description': 'Codes des natures des activités (tous par défaut), séparées par des virgules',
'example_value': 'P,1,2', 'example_value': 'P,1,2',
}, },
}, },
@ -3127,7 +3127,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Inscriptions', display_category='Inscriptions',
description="Lister les directions de la ville", description='Lister les directions de la ville',
name='read-direction-list', name='read-direction-list',
) )
def read_direction_list(self, request): def read_direction_list(self, request):
@ -3135,9 +3135,9 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Inscriptions', display_category='Inscriptions',
description="Lister les services de la ville", description='Lister les services de la ville',
name='read-service-list', name='read-service-list',
parameters={'direction_id': {'description': "Numéro de la direction sur laquelle filtrer"}}, parameters={'direction_id': {'description': 'Numéro de la direction sur laquelle filtrer'}},
) )
def read_service_list(self, request, direction_id=None): def read_service_list(self, request, direction_id=None):
queryset = self.referential.filter(referential_name='Service') queryset = self.referential.filter(referential_name='Service')
@ -3147,7 +3147,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Inscriptions', display_category='Inscriptions',
description="Lister les indicateurs pour les activités petite enfance", description='Lister les indicateurs pour les activités petite enfance',
name='read-ape-indicators-list', name='read-ape-indicators-list',
) )
def read_ape_indicators_list(self, request, level=None): def read_ape_indicators_list(self, request, level=None):
@ -3211,7 +3211,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
'person_id': {'description': "Numéro du responsable légal ou de l'enfant"}, 'person_id': {'description': "Numéro du responsable légal ou de l'enfant"},
'activity_id': {'description': "Numéro de l'activité"}, 'activity_id': {'description': "Numéro de l'activité"},
'unit_id': {'description': "Numéro de l'unité"}, 'unit_id': {'description': "Numéro de l'unité"},
'place_id': {'description': "Numéro du lieu"}, 'place_id': {'description': 'Numéro du lieu'},
'NameID': {'description': 'Publik NameID'}, 'NameID': {'description': 'Publik NameID'},
'family_id': {'description': 'Numéro de DUI'}, 'family_id': {'description': 'Numéro de DUI'},
'ref_date': {'description': 'Date du début du calcul'}, 'ref_date': {'description': 'Date du début du calcul'},
@ -3367,7 +3367,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Inscriptions', display_category='Inscriptions',
description="Ajouter au panier une inscription extra-scolaire ou loisir", description='Ajouter au panier une inscription extra-scolaire ou loisir',
name='add-person-basket-subscription', name='add-person-basket-subscription',
post={ post={
'request_body': { 'request_body': {
@ -3440,7 +3440,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Inscriptions', display_category='Inscriptions',
description="Ajouter une inscription extra-scolaire ou loisir", description='Ajouter une inscription extra-scolaire ou loisir',
name='add-person-subscription', name='add-person-subscription',
post={ post={
'request_body': { 'request_body': {
@ -3677,7 +3677,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Inscriptions', display_category='Inscriptions',
description="Obtenir les paniers de la famille", description='Obtenir les paniers de la famille',
name='get-baskets', name='get-baskets',
parameters={ parameters={
'NameID': {'description': 'Publik NameID'}, 'NameID': {'description': 'Publik NameID'},
@ -3697,7 +3697,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Inscriptions', display_category='Inscriptions',
description="Prolonger la durée de vie du panier", description='Prolonger la durée de vie du panier',
name='update-basket-time', name='update-basket-time',
parameters={ parameters={
'NameID': {'description': 'Publik NameID'}, 'NameID': {'description': 'Publik NameID'},
@ -3714,7 +3714,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Inscriptions', display_category='Inscriptions',
description="Supprimer une ligne du panier", description='Supprimer une ligne du panier',
name='delete-basket-line', name='delete-basket-line',
parameters={ parameters={
'NameID': {'description': 'Publik NameID'}, 'NameID': {'description': 'Publik NameID'},
@ -3742,7 +3742,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Inscriptions', display_category='Inscriptions',
description="Supprimer le panier de la famille", description='Supprimer le panier de la famille',
name='delete-basket', name='delete-basket',
parameters={ parameters={
'NameID': {'description': 'Publik NameID'}, 'NameID': {'description': 'Publik NameID'},
@ -3766,7 +3766,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Inscriptions', display_category='Inscriptions',
description="Valider le panier de la famille", description='Valider le panier de la famille',
name='validate-basket', name='validate-basket',
parameters={ parameters={
'NameID': {'description': 'Publik NameID'}, 'NameID': {'description': 'Publik NameID'},
@ -3803,7 +3803,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Inscriptions', display_category='Inscriptions',
description="Lister les crèches", description='Lister les crèches',
name='read-nursery-list', name='read-nursery-list',
parameters={ parameters={
'activity_type': {'description': "Type de l'activité.", 'example_value': 'CRECHCO'}, 'activity_type': {'description': "Type de l'activité.", 'example_value': 'CRECHCO'},
@ -3831,7 +3831,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Inscriptions', display_category='Inscriptions',
description="Obtenir un geojson avec la liste des crèches", description='Obtenir un geojson avec la liste des crèches',
name='get-nursery-geojson', name='get-nursery-geojson',
parameters={ parameters={
'activity_type': {'description': "Type de l'activité.", 'example_value': 'CRECHCO'}, 'activity_type': {'description': "Type de l'activité.", 'example_value': 'CRECHCO'},
@ -3879,7 +3879,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Inscriptions', display_category='Inscriptions',
description="Créer une demande de place en crèche pour un enfant", description='Créer une demande de place en crèche pour un enfant',
name='create-nursery-demand', name='create-nursery-demand',
post={'request_body': {'schema': {'application/json': family_schemas.NURSERY_DEMAND_SCHEMA}}}, post={'request_body': {'schema': {'application/json': family_schemas.NURSERY_DEMAND_SCHEMA}}},
) )
@ -3957,7 +3957,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint( @endpoint(
display_category='Facture', display_category='Facture',
description="Lister les régies", description='Lister les régies',
name='read-regie-list', name='read-regie-list',
) )
def read_regie_list(self, request): def read_regie_list(self, request):
@ -4444,7 +4444,7 @@ class Subscription(models.Model):
if self.status() == 'removed': if self.status() == 'removed':
self.wcs_trigger_payload['err_desc'] = "Le panier n'a pas été validé" self.wcs_trigger_payload['err_desc'] = "Le panier n'a pas été validé"
if self.status() == 'cancelled': if self.status() == 'cancelled':
self.wcs_trigger_payload['err_desc'] = "La facture a été annulée" self.wcs_trigger_payload['err_desc'] = 'La facture a été annulée'
self.save() self.save()
self.resource.add_job( self.resource.add_job(
'trigger_subscription_job', 'trigger_subscription_job',

View File

@ -31,7 +31,7 @@ def check(args):
print(result) print(result)
if __name__ == "__main__": if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors') parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors')
parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod') parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod')

View File

@ -31,7 +31,7 @@ def check(args):
print(result) print(result)
if __name__ == "__main__": if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors') parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors')
parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod') parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod')

View File

@ -40,7 +40,7 @@ def check(args):
print(result) print(result)
if __name__ == "__main__": if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors') parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors')
parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod') parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod')

View File

@ -15,7 +15,7 @@ def check(args):
print(result) print(result)
if __name__ == "__main__": if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors') parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors')
parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod') parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod')

View File

@ -66,7 +66,7 @@ def check(args):
sys.exit(returncode) sys.exit(returncode)
if __name__ == "__main__": if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors') parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors')
parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod') parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod')

View File

@ -18,7 +18,7 @@ def check(args):
print(results) print(results)
if __name__ == "__main__": if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors') parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors')
parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod') parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod')

View File

@ -17,7 +17,7 @@ def check(args):
print(results) print(results)
if __name__ == "__main__": if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors') parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors')
parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod') parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod')

View File

@ -13,7 +13,7 @@ def check(args):
print(results) print(results)
if __name__ == "__main__": if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors') parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors')
parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod') parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod')

View File

@ -25,7 +25,7 @@ def check(args):
print(result) print(result)
if __name__ == "__main__": if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors') parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors')
parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod') parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod')

View File

@ -26,7 +26,7 @@ def check(args):
print(results) print(results)
if __name__ == "__main__": if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors') parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors')
parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod') parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod')

View File

@ -19,7 +19,7 @@ def check(args):
print(results) print(results)
if __name__ == "__main__": if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors') parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors')
parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod') parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod')

View File

@ -82,7 +82,7 @@ def check(args):
) )
if __name__ == "__main__": if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors') parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors')
parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod') parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod')

View File

@ -38,7 +38,7 @@ def check(args):
print(day) print(day)
if __name__ == "__main__": if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors') parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors')
parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod') parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod')

View File

@ -68,7 +68,7 @@ def check(args):
print(' place: %s / %s' % (results['place']['idPlace'], results['place']['lib1'])) print(' place: %s / %s' % (results['place']['idPlace'], results['place']['lib1']))
if __name__ == "__main__": if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors') parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors')
parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod') parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod')

View File

@ -62,7 +62,7 @@ def check(args):
break break
if __name__ == "__main__": if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors') parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors')
parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod') parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod')

View File

@ -105,7 +105,7 @@ def check(args):
pprint.pprint(data) pprint.pprint(data)
if __name__ == "__main__": if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors') parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors')
parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod') parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod')

View File

@ -16,7 +16,7 @@ def check(args):
print(' * %s: %s' % (a_type['code'], a_type['libelle'])) print(' * %s: %s' % (a_type['code'], a_type['libelle']))
if __name__ == "__main__": if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors') parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors')
parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod') parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod')

View File

@ -22,7 +22,7 @@ def check(args):
return result return result
if __name__ == "__main__": if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors') parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors')
parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod') parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod')

View File

@ -24,7 +24,7 @@ def check(args):
print(result) print(result)
if __name__ == "__main__": if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors') parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors')
parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod') parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod')

View File

@ -21,7 +21,7 @@ def check(args):
print(json.dumps(serialize_object(results), cls=utils.DjangoJSONEncoder, indent=2)) print(json.dumps(serialize_object(results), cls=utils.DjangoJSONEncoder, indent=2))
if __name__ == "__main__": if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors') parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors')
parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod') parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod')

View File

@ -37,7 +37,7 @@ def check(args):
assert len(results) > 1 assert len(results) > 1
if __name__ == "__main__": if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors') parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors')
parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod') parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod')

View File

@ -29,7 +29,7 @@ def check(args):
print(results) print(results)
if __name__ == "__main__": if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors') parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors')
parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod') parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod')

View File

@ -21,7 +21,7 @@ def check(args):
print(results) print(results)
if __name__ == "__main__": if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors') parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors')
parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod') parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod')

View File

@ -25,7 +25,7 @@ def check(args):
print(result) print(result)
if __name__ == "__main__": if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors') parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors')
parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod') parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod')

View File

@ -17,7 +17,7 @@ def check(args):
print(result) print(result)
if __name__ == "__main__": if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors') parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors')
parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod') parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod')

View File

@ -34,7 +34,7 @@ def check(args):
print(res) print(res)
if __name__ == "__main__": if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors') parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors')
parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod') parser.add_argument('--env', '-e', default='integ', help='dev, test, integ, prod')

Some files were not shown because too many files have changed in this diff Show More