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

View File

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

View File

@ -5,25 +5,25 @@ import pytest
def pytest_addoption(parser):
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-username", help="Username 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('--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-username', help='Username 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')
@pytest.fixture(scope='session')
def cmisclient(request):
return cmislib.CmisClient(
request.config.getoption("--cmis-endpoint"),
request.config.getoption("--cmis-username"),
request.config.getoption("--cmis-password"),
request.config.getoption('--cmis-endpoint'),
request.config.getoption('--cmis-username'),
request.config.getoption('--cmis-password'),
)
@pytest.fixture(scope='session')
def cmis_connector(request):
return request.config.getoption("--cmis-connector-url")
return request.config.getoption('--cmis-connector-url')
@pytest.fixture(scope='session')
@ -31,6 +31,6 @@ def cmis_tmpdir(cmisclient, request):
path = 'test-%s' % random.randint(0, 10000)
folder = cmisclient.defaultRepository.rootFolder.createFolder(path)
yield folder.properties['cmis:path']
preserve_tree = request.config.getoption("--preserve-tree")
preserve_tree = request.config.getoption('--preserve-tree')
if not preserve_tree:
folder.deleteTree()

View File

@ -10,7 +10,7 @@ SPECIAL_CHARS = '!#$%&+-^_`;[]{}+='
@pytest.mark.parametrize(
"path,file_name",
'path,file_name',
[
('', 'some.file'),
('/toto', 'some.file'),
@ -31,8 +31,8 @@ def test_uploadfile(cmisclient, cmis_connector, cmis_tmpdir, tmpdir, monkeypatch
response = requests.post(
url,
json={
"path": cmis_tmpdir + path,
"file": {"content": file_b64_content, "filename": file_name, "content_type": "image/jpeg"},
'path': cmis_tmpdir + path,
'file': {'content': file_b64_content, 'filename': file_name, 'content_type': 'image/jpeg'},
},
)
assert response.status_code == 200
@ -59,8 +59,8 @@ def test_uploadfile_conflict(cmisclient, cmis_connector, cmis_tmpdir, tmpdir, mo
response = requests.post(
url,
json={
"path": cmis_tmpdir + '/uploadconflict',
"file": {"content": file_b64_content, "filename": 'some.file', "content_type": "image/jpeg"},
'path': cmis_tmpdir + '/uploadconflict',
'file': {'content': file_b64_content, 'filename': 'some.file', 'content_type': 'image/jpeg'},
},
)
assert response.status_code == 200
@ -70,11 +70,11 @@ def test_uploadfile_conflict(cmisclient, cmis_connector, cmis_tmpdir, tmpdir, mo
response = requests.post(
url,
json={
"path": cmis_tmpdir + '/uploadconflict',
"file": {"content": file_b64_content, "filename": 'some.file', "content_type": "image/jpeg"},
'path': cmis_tmpdir + '/uploadconflict',
'file': {'content': file_b64_content, 'filename': 'some.file', 'content_type': 'image/jpeg'},
},
)
assert response.status_code == 200
resp_data = response.json()
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):
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')
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):
print("%s \n" % endpoint)
print('%s \n' % endpoint)
url = conn + '/%s' % endpoint
resp = requests.get(url)
resp.raise_for_status()

View File

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

View File

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

View File

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

View File

@ -36,7 +36,7 @@ def test_link(conn, update_data):
res = resp.json()
assert res['err'] == 1
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
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')
@pytest.mark.parametrize("rl", ['1', '2'])
@pytest.mark.parametrize('rl', ['1', '2'])
def test_update_rlg(conn, update_data, rl):
rlg = 'rl' + rl
RLG = 'RL' + rl
@ -370,7 +370,7 @@ def test_update_rlg(conn, update_data, rl):
in res['err_desc']
)
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
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:
break
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_label'] == 'Temps du midi'
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:
break
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_label'] == 'RESTAURATION ADULTE'
assert booking['prefill'] is False

View File

@ -2,9 +2,9 @@ import pytest
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')
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):
print("%s \n" % endpoint)
print('%s \n' % endpoint)
url = conn + '/%s' % endpoint
resp = requests.get(url)
resp.raise_for_status()
@ -50,7 +50,7 @@ def test_book_event(conn):
themes = call_generic(conn, 'themes')
random.shuffle(themes)
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.raise_for_status()
res = resp.json()

View File

@ -2,8 +2,8 @@
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "passerelle.settings")
if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'passerelle.settings')
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'),
'request_body': {'schema': {'application/json': DOCUMENT_CREATION_SCHEMA}},
},
name="create-document",
name='create-document',
parameters={
'entity_id': {'description': _('Entity ID'), 'example_value': '42'},
},
@ -203,7 +203,7 @@ class AdullactPastell(BaseResource, HTTPResource):
'description': _('Upload a file to a document'),
'request_body': {'schema': {'application/json': DOCUMENT_FILE_UPLOAD_SCHEMA}},
},
name="upload-document-file",
name='upload-document-file',
parameters={
'entity_id': {'description': _('Entity ID'), 'example_value': '42'},
'document_id': {'description': _('Document ID'), 'example_value': 'hDWtdSC'},
@ -217,7 +217,7 @@ class AdullactPastell(BaseResource, HTTPResource):
@endpoint(
description=_('Get document\'s file'),
name="get-document-file",
name='get-document-file',
parameters={
'entity_id': {'description': _('Entity ID'), 'example_value': '42'},
'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. "
"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. "
@ -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 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:
raise APIError('No JSON content returned: %r' % response.content[:1000])
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']:
try:
data_administratives = demand['data_administratives']

View File

@ -240,7 +240,7 @@ class ASTech(BaseResource, HTTPResource):
@endpoint(
name='services',
description=_("List authorized services for connected user"),
description=_('List authorized services for connected user'),
display_category=_('Rules'),
display_order=1,
)
@ -331,7 +331,7 @@ class ASTech(BaseResource, HTTPResource):
@endpoint(
name='parameter',
description=_("Value of a parameter"),
description=_('Value of a parameter'),
parameters={
'name': {'description': _('Name of the parameter'), 'example_value': 'LIBELDEMDEF'},
'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
ASSOCIATION_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "AstreGS assocation",
"description": "",
"type": "object",
"required": [
"Financier",
"CodeFamille",
"CatTiers",
"NomEnregistrement",
"StatutTiers",
"Type",
"AdresseTitre",
"AdresseIsAdresseDeCommande",
"AdresseIsAdresseDeFacturation",
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'AstreGS assocation',
'description': '',
'type': 'object',
'required': [
'Financier',
'CodeFamille',
'CatTiers',
'NomEnregistrement',
'StatutTiers',
'Type',
'AdresseTitre',
'AdresseIsAdresseDeCommande',
'AdresseIsAdresseDeFacturation',
],
"properties": {
"Financier": {"description": "financial association", "type": "string", "enum": ["true", "false"]},
"CodeFamille": {
"description": "association family code",
"type": "string",
'properties': {
'Financier': {'description': 'financial association', 'type': 'string', 'enum': ['true', 'false']},
'CodeFamille': {
'description': 'association family code',
'type': 'string',
},
"CatTiers": {
"description": "association category",
"type": "string",
'CatTiers': {
'description': 'association category',
'type': 'string',
},
"NomEnregistrement": {
"description": "association name",
"type": "string",
'NomEnregistrement': {
'description': 'association name',
'type': 'string',
},
"StatutTiers": {
"description": "association status",
"type": "string",
"enum": ["PROPOSE", "VALIDE", "REFUSE", "BLOQUE", "A COMPLETER"],
'StatutTiers': {
'description': 'association status',
'type': 'string',
'enum': ['PROPOSE', 'VALIDE', 'REFUSE', 'BLOQUE', 'A COMPLETER'],
},
"Type": {"description": "association type", "type": "string", "enum": ["D", "F", "*"]},
"NumeroSiret": {
"description": "SIREN number",
"type": "string",
'Type': {'description': 'association type', 'type': 'string', 'enum': ['D', 'F', '*']},
'NumeroSiret': {
'description': 'SIREN number',
'type': 'string',
},
"NumeroSiretFin": {
"description": "NIC number",
"type": "string",
'NumeroSiretFin': {
'description': 'NIC number',
'type': 'string',
},
"AdresseTitre": {
"type": "string",
'AdresseTitre': {
'type': 'string',
},
"AdresseIsAdresseDeCommande": {"type": "string", "enum": ["true", "false"]},
"AdresseIsAdresseDeFacturation": {"type": "string", "enum": ["true", "false"]},
"organism": {
"description": _('Organisme'),
"type": "string",
'AdresseIsAdresseDeCommande': {'type': 'string', 'enum': ['true', 'false']},
'AdresseIsAdresseDeFacturation': {'type': 'string', 'enum': ['true', 'false']},
'organism': {
'description': _('Organisme'),
'type': 'string',
},
"budget": {
"description": _('Budget'),
"type": "string",
'budget': {
'description': _('Budget'),
'type': 'string',
},
"exercice": {
"description": _('Exercice'),
"type": "string",
'exercice': {
'description': _('Exercice'),
'type': 'string',
},
},
}
CONTACT_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "AstreGS contact",
"description": "",
"type": "object",
"required": [
"CodeContact",
"CodeTitreCivilite",
"Nom",
"AdresseDestinataire",
"CodePostal",
"Ville",
"EncodeKeyStatut",
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'AstreGS contact',
'description': '',
'type': 'object',
'required': [
'CodeContact',
'CodeTitreCivilite',
'Nom',
'AdresseDestinataire',
'CodePostal',
'Ville',
'EncodeKeyStatut',
],
"properties": {
"CodeContact": {
"type": "string",
'properties': {
'CodeContact': {
'type': 'string',
},
"CodeTitreCivilite": {
"type": "string",
'CodeTitreCivilite': {
'type': 'string',
},
"Nom": {
"type": "string",
'Nom': {
'type': 'string',
},
"AdresseDestinataire": {
"type": "string",
'AdresseDestinataire': {
'type': 'string',
},
"CodePostal": {
"type": "string",
'CodePostal': {
'type': 'string',
},
"Ville": {
"type": "string",
'Ville': {
'type': 'string',
},
"EncodeKeyStatut": {
"type": "string",
'EncodeKeyStatut': {
'type': 'string',
},
"organism": {
"description": _('Organisme'),
"type": "string",
'organism': {
'description': _('Organisme'),
'type': 'string',
},
"budget": {
"description": _('Budget'),
"type": "string",
'budget': {
'description': _('Budget'),
'type': 'string',
},
"exercice": {
"description": _('Exercice'),
"type": "string",
'exercice': {
'description': _('Exercice'),
'type': 'string',
},
},
}
DOCUMENT_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "AstreGS assocation",
"description": "",
"type": "object",
"required": [
"Sujet",
"Entite",
"CodType",
"Type",
"hdnCodeTrt",
"EncodeKeyEntite",
"CodeDomaine",
"CodDom",
"document",
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'AstreGS assocation',
'description': '',
'type': 'object',
'required': [
'Sujet',
'Entite',
'CodType',
'Type',
'hdnCodeTrt',
'EncodeKeyEntite',
'CodeDomaine',
'CodDom',
'document',
],
"properties": {
"Sujet": {
"type": "string",
'properties': {
'Sujet': {
'type': 'string',
},
"Entite": {
"type": "string",
'Entite': {
'type': 'string',
},
"CodType": {
"type": "string",
'CodType': {
'type': 'string',
},
"Type": {
"type": "string",
'Type': {
'type': 'string',
},
"hdnCodeTrt": {
"type": "string",
'hdnCodeTrt': {
'type': 'string',
},
"EncodeKeyEntite": {
"type": "string",
'EncodeKeyEntite': {
'type': 'string',
},
"CodeDomaine": {
"type": "string",
'CodeDomaine': {
'type': 'string',
},
"CodDom": {
"type": "string",
'CodDom': {
'type': 'string',
},
"document": {
"type": "object",
"required": ['filename', 'content_type', 'content'],
'document': {
'type': 'object',
'required': ['filename', 'content_type', 'content'],
'properties': {
'filename': {
'type': 'string',
@ -198,236 +198,236 @@ DOCUMENT_SCHEMA = {
},
},
},
"organism": {
"description": _('Organisme'),
"type": "string",
'organism': {
'description': _('Organisme'),
'type': 'string',
},
"budget": {
"description": _('Budget'),
"type": "string",
'budget': {
'description': _('Budget'),
'type': 'string',
},
"exercice": {
"description": _('Exercice'),
"type": "string",
'exercice': {
'description': _('Exercice'),
'type': 'string',
},
},
}
GRANT_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "AstreGS grant",
"description": "",
"type": "object",
"required": [
"Libelle",
"LibelleCourt",
"ModGestion",
"TypeAide",
"Sens",
"CodeTiersDem",
"CodeServiceGestionnaire",
"CodeServiceUtilisateur",
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'AstreGS grant',
'description': '',
'type': 'object',
'required': [
'Libelle',
'LibelleCourt',
'ModGestion',
'TypeAide',
'Sens',
'CodeTiersDem',
'CodeServiceGestionnaire',
'CodeServiceUtilisateur',
],
"properties": {
"Libelle": {
"type": "string",
'properties': {
'Libelle': {
'type': 'string',
},
"LibelleCourt": {
"type": "string",
'LibelleCourt': {
'type': 'string',
},
"ModGestion": {"type": "string", "enum": ["1", "2", "3", "4"]},
"TypeAide": {
"type": "string",
'ModGestion': {'type': 'string', 'enum': ['1', '2', '3', '4']},
'TypeAide': {
'type': 'string',
},
"Sens": {
"type": "string",
'Sens': {
'type': 'string',
},
"CodeTiersDem": {
"type": "string",
'CodeTiersDem': {
'type': 'string',
},
"CodeServiceGestionnaire": {
"type": "string",
'CodeServiceGestionnaire': {
'type': 'string',
},
"CodeServiceUtilisateur": {
"type": "string",
'CodeServiceUtilisateur': {
'type': 'string',
},
"organism": {
"description": _('Organisme'),
"type": "string",
'organism': {
'description': _('Organisme'),
'type': 'string',
},
"budget": {
"description": _('Budget'),
"type": "string",
'budget': {
'description': _('Budget'),
'type': 'string',
},
"exercice": {
"description": _('Exercice'),
"type": "string",
'exercice': {
'description': _('Exercice'),
'type': 'string',
},
},
}
INDANA_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "AstreGS INDANA indicator",
"description": "",
"type": "object",
"required": ["CodeDossier", "CodeInd_1", "AnneeInd_1", "ValInd_1"],
"properties": {
"CodeDossier": {
"type": "string",
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'AstreGS INDANA indicator',
'description': '',
'type': 'object',
'required': ['CodeDossier', 'CodeInd_1', 'AnneeInd_1', 'ValInd_1'],
'properties': {
'CodeDossier': {
'type': 'string',
},
"CodeInd_1": {
"type": "string",
'CodeInd_1': {
'type': 'string',
},
"AnneeInd_1": {
"type": "string",
'AnneeInd_1': {
'type': 'string',
},
"ValInd_1": {
"type": "string",
'ValInd_1': {
'type': 'string',
},
"IndAide": {
"type": "string",
'IndAide': {
'type': 'string',
},
"organism": {
"description": _('Organisme'),
"type": "string",
'organism': {
'description': _('Organisme'),
'type': 'string',
},
"budget": {
"description": _('Budget'),
"type": "string",
'budget': {
'description': _('Budget'),
'type': 'string',
},
"exercice": {
"description": _('Exercice'),
"type": "string",
'exercice': {
'description': _('Exercice'),
'type': 'string',
},
},
}
INDANA_KEY_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "AstreGS INDANA indicator key",
"description": "",
"type": "object",
"required": ["CodeDossier", "CodeInd_1", "AnneeInd_1"],
"properties": {
"CodeDossier": {
"type": "string",
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'AstreGS INDANA indicator key',
'description': '',
'type': 'object',
'required': ['CodeDossier', 'CodeInd_1', 'AnneeInd_1'],
'properties': {
'CodeDossier': {
'type': 'string',
},
"CodeInd_1": {
"type": "string",
'CodeInd_1': {
'type': 'string',
},
"AnneeInd_1": {
"type": "string",
'AnneeInd_1': {
'type': 'string',
},
"organism": {
"description": _('Organisme'),
"type": "string",
'organism': {
'description': _('Organisme'),
'type': 'string',
},
"budget": {
"description": _('Budget'),
"type": "string",
'budget': {
'description': _('Budget'),
'type': 'string',
},
"exercice": {
"description": _('Exercice'),
"type": "string",
'exercice': {
'description': _('Exercice'),
'type': 'string',
},
},
}
TIERS_RIB_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "AstreGS TiersRib",
"description": "TiersRib",
"type": "object",
"required": [
"CodeTiers",
"CodePaiement",
"LibelleCourt",
"NumeroIban",
"CleIban",
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'AstreGS TiersRib',
'description': 'TiersRib',
'type': 'object',
'required': [
'CodeTiers',
'CodePaiement',
'LibelleCourt',
'NumeroIban',
'CleIban',
'CodeBic',
"CodeDomiciliation",
"CodeStatut",
"CodeDevise",
"CodeIso2Pays",
"LibelleCompteEtranger",
'CodeDomiciliation',
'CodeStatut',
'CodeDevise',
'CodeIso2Pays',
'LibelleCompteEtranger',
],
"properties": {
"CodeDevise": {"type": "string"},
"CodeDomiciliation": {"type": "string"},
"CodeIso2Pays": {"type": "string"},
"CodePaiement": {"type": "string"},
"CodeStatut": {
"type": "string",
"enum": ["PROPOSE", "VALIDE", "REFUSE", "A COMPLETER", "BLOQUE", "EN MODIFICATION"],
'properties': {
'CodeDevise': {'type': 'string'},
'CodeDomiciliation': {'type': 'string'},
'CodeIso2Pays': {'type': 'string'},
'CodePaiement': {'type': 'string'},
'CodeStatut': {
'type': 'string',
'enum': ['PROPOSE', 'VALIDE', 'REFUSE', 'A COMPLETER', 'BLOQUE', 'EN MODIFICATION'],
},
"CodeTiers": {"type": "string"},
"IndicateurRibDefaut": {"type": "string"},
"LibelleCompteEtranger": {"type": "string"},
"LibelleCourt": {"type": "string"},
"NumeroIban": {"type": "string"},
"CleIban": {"type": "string"},
"CodeBic": {"type": "string"},
"IdRib": {"type": "string"},
"organism": {
"description": _('Organisme'),
"type": "string",
'CodeTiers': {'type': 'string'},
'IndicateurRibDefaut': {'type': 'string'},
'LibelleCompteEtranger': {'type': 'string'},
'LibelleCourt': {'type': 'string'},
'NumeroIban': {'type': 'string'},
'CleIban': {'type': 'string'},
'CodeBic': {'type': 'string'},
'IdRib': {'type': 'string'},
'organism': {
'description': _('Organisme'),
'type': 'string',
},
"budget": {
"description": _('Budget'),
"type": "string",
'budget': {
'description': _('Budget'),
'type': 'string',
},
"exercice": {
"description": _('Exercice'),
"type": "string",
'exercice': {
'description': _('Exercice'),
'type': 'string',
},
},
}
TIERS_RIB_UPDATE_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "AstreGS TiersRib",
"description": "TiersRib Update",
"type": "object",
"required": [
"CodePaiement",
"LibelleCourt",
"NumeroIban",
"CleIban",
"CodeBic",
"CodeDomiciliation",
"CodeStatut",
"CodeDevise",
"CodeIso2Pays",
"LibelleCompteEtranger",
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'AstreGS TiersRib',
'description': 'TiersRib Update',
'type': 'object',
'required': [
'CodePaiement',
'LibelleCourt',
'NumeroIban',
'CleIban',
'CodeBic',
'CodeDomiciliation',
'CodeStatut',
'CodeDevise',
'CodeIso2Pays',
'LibelleCompteEtranger',
],
"properties": {
"CodeDevise": {"type": "string"},
"CodeDomiciliation": {"type": "string"},
"CodeIso2Pays": {"type": "string"},
"CodePaiement": {"type": "string"},
"CodeStatut": {
"type": "string",
"enum": ["PROPOSE", "VALIDE", "REFUSE", "A COMPLETER", "BLOQUE", "EN MODIFICATION"],
'properties': {
'CodeDevise': {'type': 'string'},
'CodeDomiciliation': {'type': 'string'},
'CodeIso2Pays': {'type': 'string'},
'CodePaiement': {'type': 'string'},
'CodeStatut': {
'type': 'string',
'enum': ['PROPOSE', 'VALIDE', 'REFUSE', 'A COMPLETER', 'BLOQUE', 'EN MODIFICATION'],
},
"IndicateurRibDefaut": {"type": "string"},
"LibelleCompteEtranger": {"type": "string"},
"LibelleCourt": {"type": "string"},
"NumeroIban": {"type": "string"},
"CleIban": {"type": "string"},
"CodeBic": {"type": "string"},
"organism": {
"description": _('Organisme'),
"type": "string",
'IndicateurRibDefaut': {'type': 'string'},
'LibelleCompteEtranger': {'type': 'string'},
'LibelleCourt': {'type': 'string'},
'NumeroIban': {'type': 'string'},
'CleIban': {'type': 'string'},
'CodeBic': {'type': 'string'},
'organism': {
'description': _('Organisme'),
'type': 'string',
},
"budget": {
"description": _('Budget'),
"type": "string",
'budget': {
'description': _('Budget'),
'type': 'string',
},
"exercice": {
"description": _('Exercice'),
"type": "string",
'exercice': {
'description': _('Exercice'),
'type': 'string',
},
},
}

View File

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

View File

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

View File

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

View File

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

View File

@ -326,7 +326,7 @@ class BaseAdresse(AddressResource):
perm='OPEN',
parameters={
'id': {'description': _('Street identifier')},
'q': {'description': _("Street name")},
'q': {'description': _('Street name')},
'zipcode': {'description': _('Zipcode')},
'citycode': {'description': _('INSEE City code')},
'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'),
'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': {
'description': _('INSEE code (or multiple codes separated with commas)'),
'example_value': '75056',

View File

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

View File

@ -129,10 +129,10 @@ class CmisConnector(BaseResource):
def uploadfile(self, request, post_data):
error, error_msg, data = self._validate_inputs(post_data)
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)
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:
doc = cmis_gateway.create_doc(
filename,
@ -226,15 +226,15 @@ def wrap_cmis_error(f):
return f(*args, **kwargs)
except (urllib2.URLError, httplib2.HttpLib2Error) as e:
# 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:
raise APIError("permission denied: %s" % e)
raise APIError('permission denied: %s' % e)
except UpdateConflictException as e:
raise APIError("update conflict: %s" % e)
raise APIError('update conflict: %s' % e)
except InvalidArgumentException as e:
raise APIError("invalid property name: %s" % e)
raise APIError('invalid property name: %s' % e)
except CmisException as e:
raise APIError("cmis binding error: %s" % e)
raise APIError('cmis binding error: %s' % e)
return wrapper
@ -256,7 +256,7 @@ class CMISGateway:
return res
except ObjectNotFoundException:
self._logger.debug("'%s' not found" % file_path)
basepath = ""
basepath = ''
folder = self.repo.rootFolder
for path_part in file_path.strip('/').split('/'):
basepath += '/%s' % path_part

View File

@ -37,19 +37,19 @@ from passerelle.utils.files import atomic_write
from passerelle.utils.jsonresponse import APIError
FILE_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "File to encrypt",
"description": "",
"type": "object",
"required": ["file"],
"properties": {
"file": {
"type": "object",
"required": ["filename", "content_type", "content"],
"properties": {
"filename": {"type": "string"},
"content_type": {"type": "string"},
"content": {"type": "string"},
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'File to encrypt',
'description': '',
'type': 'object',
'required': ['file'],
'properties': {
'file': {
'type': 'object',
'required': ['filename', 'content_type', 'content'],
'properties': {
'filename': {'type': 'string'},
'content_type': {'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_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()
@ -460,14 +460,14 @@ class CsvDataSource(BaseResource):
if 'id' in request.GET and not model_filters_id:
# 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]]
# allow jsonp queries by select2
# filtering is done there after projection because we need a projection named text for
# retro-compatibility with previous use of the csvdatasource with select2
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]]
# force rendition of iterator as list

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -60,7 +60,7 @@ class 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):
self.flow_type = args[0]

View File

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

View File

@ -55,6 +55,6 @@ class MobytSMSGateway(SMSResource):
r = self.requests.post(self.URL, data=params)
except requests.RequestException as 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"')
# credit consumed is unknown

View File

@ -176,7 +176,7 @@ class Query(BaseQuery):
sort = models.CharField(
verbose_name=_('Sort field'),
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,
blank=True,

View File

@ -25,7 +25,7 @@ from .forms import QueryForm
class QueryNew(ResourceChildViewMixin, CreateView):
model = models.Query
form_class = QueryForm
template_name = "passerelle/manage/resource_child_form.html"
template_name = 'passerelle/manage/resource_child_form.html'
def get_form_kwargs(self):
kwargs = super().get_form_kwargs()
@ -36,9 +36,9 @@ class QueryNew(ResourceChildViewMixin, CreateView):
class QueryEdit(ResourceChildViewMixin, UpdateView):
model = models.Query
form_class = QueryForm
template_name = "passerelle/manage/resource_child_form.html"
template_name = 'passerelle/manage/resource_child_form.html'
class QueryDelete(ResourceChildViewMixin, DeleteView):
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_lat = closest_feature['geometry']['coordinates'][1]
point_lon, point_lat = self.convert_coordinates(point_lon, point_lat, reverse=True)
result['lon'] = "%.6f" % point_lon
result['lat'] = "%.6f" % point_lat
result['lon'] = '%.6f' % point_lon
result['lat'] = '%.6f' % point_lat
result['address'] = {}
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 ''
now = str(int(time.time()))
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())
headers = {
'X-Ovh-Application': self.application_key,
'X-Ovh-Consumer': self.consumer_key,
'X-Ovh-Timestamp': now,
'X-Ovh-Signature': "$1$" + signature.hexdigest(),
'X-Ovh-Signature': '$1$' + signature.hexdigest(),
}
try:

View File

@ -11,18 +11,18 @@ from .models import OVHSMSGateway
class RequestTokenView(RedirectView):
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()
confirm_token_url = reverse('ovh-confirm-token', kwargs={'slug': connector.slug, 'uuid': request_id})
data = {
"accessRules": [
{"method": "GET", "path": "/sms/%s/" % connector.account},
{"method": "POST", "path": "/sms/%s/jobs/" % connector.account},
'accessRules': [
{'method': 'GET', 'path': '/sms/%s/' % 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:
resp = connector.requests.post(
@ -49,7 +49,7 @@ class RequestTokenView(RedirectView):
class ConfirmTokenView(RedirectView):
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'])
if consumer_key:

View File

@ -23,8 +23,8 @@ class OxydSMSGateway(SMSResource):
'err': 1,
'err_desc': 'OXYD error: some destinations failed',
'data': [
['0033688888888', "OXYD error: response is not 200"],
['0033677777777', "OXYD error: response is not 200"],
['0033688888888', '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(
verbose_name=_('Ascending sort order'),
help_text=_("Unset to use descending sort order"),
help_text=_('Unset to use descending sort order'),
default=True,
)
limit = models.PositiveIntegerField(

View File

@ -25,7 +25,7 @@ from .forms import QueryForm
class QueryNew(ResourceChildViewMixin, CreateView):
model = models.Query
form_class = QueryForm
template_name = "passerelle/manage/resource_child_form.html"
template_name = 'passerelle/manage/resource_child_form.html'
def get_form_kwargs(self):
kwargs = super().get_form_kwargs()
@ -36,9 +36,9 @@ class QueryNew(ResourceChildViewMixin, CreateView):
class QueryEdit(ResourceChildViewMixin, UpdateView):
model = models.Query
form_class = QueryForm
template_name = "passerelle/manage/resource_child_form.html"
template_name = 'passerelle/manage/resource_child_form.html'
class QueryDelete(ResourceChildViewMixin, DeleteView):
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):
if request_id:
url = f"{endpoint}/{request_id}"
url = f'{endpoint}/{request_id}'
else:
url = endpoint

View File

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

View File

@ -45,8 +45,8 @@ class TwilioSMSGateway(SMSResource):
'err': 1,
'err_desc': 'Twilio error: some destinations failed',
'data': [
['+33688888888', "Twilio error: my error message"],
['+33677777777', "Twilio error: my error message"],
['+33688888888', '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
EVENTBOOK_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Vivaticket",
"description": "",
"type": "object",
"required": [
"id",
"email",
"start_datetime",
"end_datetime",
"event",
"theme",
"room",
"quantity",
"form_url",
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'Vivaticket',
'description': '',
'type': 'object',
'required': [
'id',
'email',
'start_datetime',
'end_datetime',
'event',
'theme',
'room',
'quantity',
'form_url',
],
"properties": {
"id": {
"description": "formdata id",
"type": "string",
'properties': {
'id': {
'description': 'formdata id',
'type': 'string',
},
"title": {
"description": "user title",
"type": "string",
'title': {
'description': 'user title',
'type': 'string',
},
"last_name": {
"description": "user last name",
"type": "string",
'last_name': {
'description': 'user last name',
'type': 'string',
},
"first_name": {
"description": "user first name",
"type": "string",
'first_name': {
'description': 'user first name',
'type': 'string',
},
"social_reason": {
"description": "user social reason",
"type": "string",
'social_reason': {
'description': 'user social reason',
'type': 'string',
},
"address": {
"description": "user address",
"type": "string",
'address': {
'description': 'user address',
'type': 'string',
},
"zipcode": {
"description": "user zipcode",
"type": "string",
'zipcode': {
'description': 'user zipcode',
'type': 'string',
},
"city": {
"description": "user city",
"type": "string",
'city': {
'description': 'user city',
'type': 'string',
},
"country": {
"description": "user country",
"type": "string",
'country': {
'description': 'user country',
'type': 'string',
},
"phone": {
"description": "user phone",
"type": "string",
'phone': {
'description': 'user phone',
'type': 'string',
},
"mobile": {
"description": "user mobile",
"type": "string",
'mobile': {
'description': 'user mobile',
'type': 'string',
},
"email": {
"description": "user email",
"type": "string",
'email': {
'description': 'user email',
'type': 'string',
},
"start_datetime": {
"description": "event start datetime",
"type": "string",
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}$",
'start_datetime': {
'description': 'event start datetime',
'type': 'string',
'pattern': '^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}$',
},
"end_datetime": {
"description": "event end datetime",
"type": "string",
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}$",
'end_datetime': {
'description': 'event end datetime',
'type': 'string',
'pattern': '^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}$',
},
"event": {
"description": "event id",
"type": "string",
'event': {
'description': 'event id',
'type': 'string',
},
"theme": {
"description": "theme id",
"type": "string",
'theme': {
'description': 'theme id',
'type': 'string',
},
"room": {
"description": "room id",
"type": "string",
'room': {
'description': 'room id',
'type': 'string',
},
"quantity": {"description": "quantity", "type": "string", "pattern": "^[0-9]+$"},
"booking_comment": {
"description": "booking comment",
"type": "string",
'quantity': {'description': 'quantity', 'type': 'string', 'pattern': '^[0-9]+$'},
'booking_comment': {
'description': 'booking comment',
'type': 'string',
},
"room_comment": {
"description": "room comment",
"type": "string",
'room_comment': {
'description': 'room comment',
'type': 'string',
},
"form_url": {
"description": "form url",
"type": "string",
'form_url': {
'description': 'form url',
'type': 'string',
},
"school_level": {
"description": "School Level code",
"type": "string",
'school_level': {
'description': 'School Level code',
'type': 'string',
},
},
}
@ -192,7 +192,7 @@ class VivaTicket(BaseResource):
response = self.get(endpoint, **kwargs)
json = response.json()
data = []
for setting in json.get("ListOfSettings", []):
for setting in json.get('ListOfSettings', []):
data.append({'id': setting['Code'], 'text': setting['Label']})
return {'data': data}

View File

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

View File

@ -169,7 +169,7 @@ class BaseResource(models.Model):
category = (
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):
if request.user.is_superuser:
@ -264,7 +264,7 @@ class BaseResource(models.Model):
hide_fields.extend(self.hide_description_fields)
for field in self._meta.fields:
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
):
continue
@ -982,7 +982,7 @@ class ProxyLogger:
continue
if not parsed.username and not parsed.password:
continue
replaced = parsed._replace(netloc="{}:{}@{}".format('***', '***', parsed.hostname))
replaced = parsed._replace(netloc='{}:{}@{}'.format('***', '***', parsed.hostname))
message = message.replace(url, replaced.geturl())
levelno = getattr(logging, levelname)
@ -1031,7 +1031,7 @@ class ProxyLogger:
if getattr(request, 'META', None):
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:
sourceip = request.META.get('REMOTE_ADDR')
else:

View File

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

View File

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

View File

@ -128,10 +128,10 @@ class Greco(BaseResource):
HttpAuthenticated.__init__(self)
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:
# 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.add_header('Content-ID', '<rootpart@entrouvert.org>')
# do not base64-encode the soap message

View File

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

View File

@ -36,133 +36,133 @@ API_VERSION = [
API_VERSION_DEFAULT = '1.0.0'
SITE_BOOKING_SCHOOL_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "ENS site/booking/school",
"description": "",
"type": "object",
"required": [
"site",
"date",
"pmr",
"morning",
"lunch",
"afternoon",
"participants",
"grade_levels",
"beneficiary_first_name",
"beneficiary_last_name",
"beneficiary_email",
"beneficiary_phone",
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'ENS site/booking/school',
'description': '',
'type': 'object',
'required': [
'site',
'date',
'pmr',
'morning',
'lunch',
'afternoon',
'participants',
'grade_levels',
'beneficiary_first_name',
'beneficiary_last_name',
'beneficiary_email',
'beneficiary_phone',
],
"properties": OrderedDict(
'properties': OrderedDict(
{
"external_id": {
"description": "external id",
"type": "string",
'external_id': {
'description': 'external id',
'type': 'string',
},
"site": {
"description": "site id (code)",
"type": "string",
'site': {
'description': 'site id (code)',
'type': 'string',
},
"project": {
"description": "project code",
"type": "string",
'project': {
'description': 'project code',
'type': 'string',
},
"date": {
"description": "booking date (format: YYYY-MM-DD)",
"type": "string",
'date': {
'description': 'booking date (format: YYYY-MM-DD)',
'type': 'string',
},
"pmr": {
"description": "PMR",
"type": "boolean",
'pmr': {
'description': 'PMR',
'type': 'boolean',
},
"morning": {
"description": "morning booking",
"type": "boolean",
'morning': {
'description': 'morning booking',
'type': 'boolean',
},
"lunch": {
"description": "lunch booking",
"type": "boolean",
'lunch': {
'description': 'lunch booking',
'type': 'boolean',
},
"afternoon": {
"description": "afternoon booking",
"type": "boolean",
'afternoon': {
'description': 'afternoon booking',
'type': 'boolean',
},
"participants": {
"description": "number of participants",
"type": "string",
"pattern": "^[0-9]+$",
'participants': {
'description': 'number of participants',
'type': 'string',
'pattern': '^[0-9]+$',
},
"animator": {
"description": "animator id",
"type": "string",
"pattern": "^[0-9]*$",
'animator': {
'description': 'animator id',
'type': 'string',
'pattern': '^[0-9]*$',
},
"group": {
"description": "school group id (API v2.1.0/v2.1.1, use applicant if empty)",
"type": "string",
"pattern": "^[0-9]*$",
'group': {
'description': 'school group id (API v2.1.0/v2.1.1, use applicant if empty)',
'type': 'string',
'pattern': '^[0-9]*$',
},
"applicant": {
"description": "applicant",
"type": "string",
'applicant': {
'description': 'applicant',
'type': 'string',
},
"grade_levels": {
"description": "grade levels",
"type": "array",
"items": {
"type": "string",
"description": "level",
'grade_levels': {
'description': 'grade levels',
'type': 'array',
'items': {
'type': 'string',
'description': 'level',
},
},
"beneficiary_first_name": {
"description": "beneficiary first name",
"type": "string",
'beneficiary_first_name': {
'description': 'beneficiary first name',
'type': 'string',
},
"beneficiary_last_name": {
"description": "beneficiary last name",
"type": "string",
'beneficiary_last_name': {
'description': 'beneficiary last name',
'type': 'string',
},
"beneficiary_email": {
"description": "beneficiary email",
"type": "string",
'beneficiary_email': {
'description': 'beneficiary email',
'type': 'string',
},
"beneficiary_phone": {
"description": "beneficiary phone number",
"type": "string",
'beneficiary_phone': {
'description': 'beneficiary phone number',
'type': 'string',
},
"beneficiary_cellphone": {
"description": "beneficiary cell phone number",
"type": "string",
'beneficiary_cellphone': {
'description': 'beneficiary cell phone number',
'type': 'string',
},
# v1.0.0 only
"code": {
"description": "booking code (API v1.0.0)",
"type": "string",
'code': {
'description': 'booking code (API v1.0.0)',
'type': 'string',
},
"status": {
"description": "booking status (API v1.0.0)",
"type": "string",
'status': {
'description': 'booking status (API v1.0.0)',
'type': 'string',
},
"beneficiary_id": {
"description": "beneficiary id (API v1.0.0)",
"type": "string",
'beneficiary_id': {
'description': 'beneficiary id (API v1.0.0)',
'type': 'string',
},
"public": {
"description": "public (API v1.0.0)",
"type": "string",
'public': {
'description': 'public (API v1.0.0)',
'type': 'string',
},
"entity_id": {
"description": "entity/school id (UAI/RNE) (API v1.0.0)",
"type": "string",
'entity_id': {
'description': 'entity/school id (UAI/RNE) (API v1.0.0)',
'type': 'string',
},
"entity_name": {
"description": "entity/school name (API v1.0.0)",
"type": "string",
'entity_name': {
'description': 'entity/school name (API v1.0.0)',
'type': 'string',
},
"entity_type": {
"description": "entity/school type (API v1.0.0)",
"type": "string",
'entity_type': {
'description': 'entity/school type (API v1.0.0)',
'type': 'string',
},
}
),
@ -170,15 +170,15 @@ SITE_BOOKING_SCHOOL_SCHEMA = {
class IsereENS(BaseResource, HTTPResource):
category = _("Business Process Connectors")
category = _('Business Process Connectors')
base_url = models.URLField(
verbose_name=_("Webservice Base URL"),
help_text=_("Base API URL (before /api/...)"),
verbose_name=_('Webservice Base URL'),
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(
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:
@ -186,7 +186,7 @@ class IsereENS(BaseResource, HTTPResource):
def request(self, endpoint, params=None, json=None, method='get'):
url = urlparse.urljoin(self.base_url, endpoint)
headers = {"token": self.token}
headers = {'token': self.token}
if method == 'post' or json is not None:
response = self.requests.post(url, params=params, json=json, headers=headers)
else:
@ -198,169 +198,169 @@ class IsereENS(BaseResource, HTTPResource):
except ValueError:
json_content = None
raise APIError(
"error status:%s %r, content:%r"
'error status:%s %r, content:%r'
% (response.status_code, response.reason, response.content[:1024]),
data={
"status_code": response.status_code,
"json_content": json_content,
'status_code': response.status_code,
'json_content': json_content,
},
)
if response.status_code == 204: # 204 No Content
raise APIError("abnormal empty response")
raise APIError('abnormal empty response')
try:
return response.json()
except ValueError:
raise APIError("invalid JSON in response: %r" % response.content[:1024])
raise APIError('invalid JSON in response: %r' % response.content[:1024])
@endpoint(
name="sites",
description=_("Sites"),
name='sites',
description=_('Sites'),
display_order=1,
parameters={
"q": {"description": _("Search text in name field")},
"id": {
"description": _("Returns site with code=id"),
'q': {'description': _('Search text in name field')},
'id': {
'description': _('Returns site with code=id'),
},
"kind": {
"description": _("Returns only sites of this kind (school_group or social)"),
'kind': {
'description': _('Returns only sites of this kind (school_group or social)'),
},
},
)
def sites(self, request, q=None, id=None, kind=None):
if id is not None:
site = self.request("api/%s/site/%s" % (self.api_version, id))
site["id"] = site["code"]
site["text"] = "%(name)s (%(city)s)" % site
site = self.request('api/%s/site/%s' % (self.api_version, id))
site['id'] = site['code']
site['text'] = '%(name)s (%(city)s)' % site
sites = [site]
else:
cache_key = "isere-ens-sites-%d" % self.id
cache_key = 'isere-ens-sites-%d' % self.id
sites = cache.get(cache_key)
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:
site["id"] = site["code"]
site["text"] = "%(name)s (%(city)s)" % site
site['id'] = site['code']
site['text'] = '%(name)s (%(city)s)' % site
cache.set(cache_key, sites, 300)
if kind is not None:
sites = [site for site in sites if site.get(kind)]
if q is not None:
q = simplify(q)
sites = [site for site in sites if q in simplify(site["text"])]
return {"data": sites}
sites = [site for site in sites if q in simplify(site['text'])]
return {'data': sites}
@endpoint(
name="animators",
description=_("Animators"),
name='animators',
description=_('Animators'),
display_order=2,
parameters={
"q": {"description": _("Search text in name field")},
"id": {
"description": _("Returns animator number id"),
'q': {'description': _('Search text in name field')},
'id': {
'description': _('Returns animator number id'),
},
},
)
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)
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:
animator["id"] = str(animator["id"])
animator["text"] = "%(first_name)s %(last_name)s <%(email)s> (%(entity)s)" % animator
animator['id'] = str(animator['id'])
animator['text'] = '%(first_name)s %(last_name)s <%(email)s> (%(entity)s)' % animator
cache.set(cache_key, animators, 300)
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:
q = simplify(q)
animators = [animator for animator in animators if q in simplify(animator["text"])]
return {"data": animators}
animators = [animator for animator in animators if q in simplify(animator['text'])]
return {'data': animators}
@endpoint(
name="site-calendar",
description=_("Available bookings for a site"),
name='site-calendar',
description=_('Available bookings for a site'),
display_order=3,
parameters={
"site": {"description": _("Site code (aka id)")},
"participants": {
"description": _("Number of participants"),
'site': {'description': _('Site code (aka id)')},
'participants': {
'description': _('Number of participants'),
},
"start_date": {
"description": _("First date of the calendar (format: YYYY-MM-DD, default: today)"),
'start_date': {
'description': _('First date of the calendar (format: YYYY-MM-DD, default: today)'),
},
"end_date": {
"description": _(
"Last date of the calendar (format: YYYY-MM-DD, default: start_date + 92 days)"
'end_date': {
'description': _(
'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:
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:
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,
)
else:
start_date = datetime.date.today()
if end_date:
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:
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,
)
else:
end_date = start_date + datetime.timedelta(days=92)
params = {
"participants": participants,
"start_date": start_date.strftime("%Y-%m-%d"),
"end_date": end_date.strftime("%Y-%m-%d"),
'participants': participants,
'start_date': start_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):
return {
"AVAILABLE": _("available"),
"COMPLETE": _("complete"),
"OVERBOOKING": _("overbooking"),
"OPEN": _("open"),
"CLOSE": _("closed"),
}.get(status) or _("unknown")
'AVAILABLE': _('available'),
'COMPLETE': _('complete'),
'OVERBOOKING': _('overbooking'),
'OPEN': _('open'),
'CLOSE': _('closed'),
}.get(status) or _('unknown')
for date in dates:
date["id"] = site + ":" + date["date"]
date["site"] = site
date_ = datetime.datetime.strptime(date["date"], "%Y-%m-%d").date()
date["date_format"] = date_format(date_, format="DATE_FORMAT")
date["date_number"] = date_format(date_, format="d")
date["date_weekday"] = date_format(date_, format="l")
date["date_weekdayindex"] = date_format(date_, format="w")
date["date_weeknumber"] = date_format(date_, format="W")
date["date_month"] = date_format(date_, format="F Y")
date["disabled"] = False
date["status"] = "open"
for period in ("morning", "lunch", "afternoon"):
date["%s_status" % period] = status_name(date[period])
for period in ("morning", "afternoon"):
if date[period] in ("COMPLETE", "CLOSE"):
if date["status"] == "partially-open":
date["disabled"] = True
date["status"] = "closed"
date['id'] = site + ':' + date['date']
date['site'] = site
date_ = datetime.datetime.strptime(date['date'], '%Y-%m-%d').date()
date['date_format'] = date_format(date_, format='DATE_FORMAT')
date['date_number'] = date_format(date_, format='d')
date['date_weekday'] = date_format(date_, format='l')
date['date_weekdayindex'] = date_format(date_, format='w')
date['date_weeknumber'] = date_format(date_, format='W')
date['date_month'] = date_format(date_, format='F Y')
date['disabled'] = False
date['status'] = 'open'
for period in ('morning', 'lunch', 'afternoon'):
date['%s_status' % period] = status_name(date[period])
for period in ('morning', 'afternoon'):
if date[period] in ('COMPLETE', 'CLOSE'):
if date['status'] == 'partially-open':
date['disabled'] = True
date['status'] = 'closed'
else:
date["status"] = "partially-open"
date["details"] = (
_("Morning (%(morning_status)s), Lunch (%(lunch_status)s), Afternoon (%(afternoon_status)s)")
date['status'] = 'partially-open'
date['details'] = (
_('Morning (%(morning_status)s), Lunch (%(lunch_status)s), Afternoon (%(afternoon_status)s)')
% date
)
date["text"] = "%(date_format)s - %(details)s" % date
return {"data": dates}
date['text'] = '%(date_format)s - %(details)s' % date
return {'data': dates}
def site_booking_v1(self, request, post_data):
for key in (
@ -377,56 +377,56 @@ class IsereENS(BaseResource, HTTPResource):
if key not in post_data:
raise APIError('%s is mandatory (API v1.0.0)' % key, err_code='bad-request', http_status=400)
payload = {
"code": post_data["code"],
"status": post_data["status"],
"beneficiary": {
"id": post_data["beneficiary_id"],
"firstName": post_data["beneficiary_first_name"],
"lastName": post_data["beneficiary_last_name"],
"email": post_data["beneficiary_email"],
"phone": post_data["beneficiary_phone"],
"cellphone": post_data.get("beneficiary_cellphone", ""),
'code': post_data['code'],
'status': post_data['status'],
'beneficiary': {
'id': post_data['beneficiary_id'],
'firstName': post_data['beneficiary_first_name'],
'lastName': post_data['beneficiary_last_name'],
'email': post_data['beneficiary_email'],
'phone': post_data['beneficiary_phone'],
'cellphone': post_data.get('beneficiary_cellphone', ''),
},
"entity": {
"id": post_data["entity_id"],
"name": post_data["entity_name"],
"type": post_data["entity_type"],
'entity': {
'id': post_data['entity_id'],
'name': post_data['entity_name'],
'type': post_data['entity_type'],
},
"booking": {
"projectCode": post_data.get("project"),
"siteCode": post_data["site"],
"applicant": post_data["applicant"],
"public": post_data["public"],
"bookingDate": post_data["date"],
"participants": int(post_data["participants"]),
"morning": post_data["morning"],
"lunch": post_data["lunch"],
"afternoon": post_data["afternoon"],
"pmr": post_data["pmr"],
"gradeLevels": post_data["grade_levels"],
'booking': {
'projectCode': post_data.get('project'),
'siteCode': post_data['site'],
'applicant': post_data['applicant'],
'public': post_data['public'],
'bookingDate': post_data['date'],
'participants': int(post_data['participants']),
'morning': post_data['morning'],
'lunch': post_data['lunch'],
'afternoon': post_data['afternoon'],
'pmr': post_data['pmr'],
'gradeLevels': post_data['grade_levels'],
},
}
if post_data.get("animator"):
payload["booking"]["schoolAnimator"] = int(post_data["animator"])
if post_data.get('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):
raise APIError("response is not a dict", data=booking)
if "status" not in booking:
raise APIError("no status in response", data=booking)
if booking["status"] not in ("BOOKING", "OVERBOOKING"):
raise APIError("booking status is %s" % booking["status"], data=booking)
return {"data": booking}
raise APIError('response is not a dict', data=booking)
if 'status' not in booking:
raise APIError('no status in response', data=booking)
if booking['status'] not in ('BOOKING', 'OVERBOOKING'):
raise APIError('booking status is %s' % booking['status'], data=booking)
return {'data': booking}
@endpoint(
name="site-booking",
description=_("Book a site for a school"),
name='site-booking',
description=_('Book a site for a school'),
display_order=4,
methods=["post"],
methods=['post'],
post={
"request_body": {
"schema": {
"application/json": SITE_BOOKING_SCHOOL_SCHEMA,
'request_body': {
'schema': {
'application/json': SITE_BOOKING_SCHOOL_SCHEMA,
}
}
},
@ -435,20 +435,20 @@ class IsereENS(BaseResource, HTTPResource):
if self.api_version == '1.0.0':
return self.site_booking_v1(request, post_data)
payload = {
"siteCode": post_data["site"],
"bookingDate": post_data["date"],
"pmr": post_data["pmr"],
"morning": post_data["morning"],
"lunch": post_data["lunch"],
"afternoon": post_data["afternoon"],
"participants": int(post_data["participants"]),
"gradeLevels": post_data["grade_levels"],
"beneficiary": {
"firstName": post_data["beneficiary_first_name"],
"lastName": post_data["beneficiary_last_name"],
"email": post_data["beneficiary_email"],
"phone": post_data["beneficiary_phone"],
"cellphone": post_data.get("beneficiary_cellphone", ""),
'siteCode': post_data['site'],
'bookingDate': post_data['date'],
'pmr': post_data['pmr'],
'morning': post_data['morning'],
'lunch': post_data['lunch'],
'afternoon': post_data['afternoon'],
'participants': int(post_data['participants']),
'gradeLevels': post_data['grade_levels'],
'beneficiary': {
'firstName': post_data['beneficiary_first_name'],
'lastName': post_data['beneficiary_last_name'],
'email': post_data['beneficiary_email'],
'phone': post_data['beneficiary_phone'],
'cellphone': post_data.get('beneficiary_cellphone', ''),
},
}
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)
if not isinstance(booking, dict):
raise APIError("response is not a dict", data=booking)
if "status" not in booking:
raise APIError("no status in response", data=booking)
if booking["status"] not in ("BOOKING", "OVERBOOKING"):
raise APIError("booking status is %s" % booking["status"], data=booking)
return {"data": booking}
raise APIError('response is not a dict', data=booking)
if 'status' not in booking:
raise APIError('no status in response', data=booking)
if booking['status'] not in ('BOOKING', 'OVERBOOKING'):
raise APIError('booking status is %s' % booking['status'], data=booking)
return {'data': booking}
@endpoint(
name="get-site-booking",
description=_("Booking status"),
name='get-site-booking',
description=_('Booking status'),
display_order=5,
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):
@ -498,12 +498,12 @@ class IsereENS(BaseResource, HTTPResource):
return {'data': status}
@endpoint(
name="cancel-site-booking",
description=_("Cancel a booking"),
methods=["post"],
name='cancel-site-booking',
description=_('Cancel a booking'),
methods=['post'],
display_order=6,
parameters={
"code": {"description": _('External ID')},
'code': {'description': _('External ID')},
},
)
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.jsonresponse import APIError
TYPE_AGENDA = {"DECHET": "DECHETS VERTS", "ENCOMBRANT": "ENCOMBRANTS"}
C_TYPEPB = {"DECHET": "8006", "ENCOMBRANT": "8008"}
SYNDIC_C_TYPEPB = {"DECHET": "8007", "ENCOMBRANT": "8009"}
TYPE_AGENDA = {'DECHET': 'DECHETS VERTS', 'ENCOMBRANT': 'ENCOMBRANTS'}
C_TYPEPB = {'DECHET': '8006', 'ENCOMBRANT': '8008'}
SYNDIC_C_TYPEPB = {'DECHET': '8007', 'ENCOMBRANT': '8009'}
NS = '{http://isilog.fr}'
BOOKDATE_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "IWS",
"description": "",
"type": "object",
"required": ["firstname", "lastname", "email_notif", "date", "token"],
"properties": {
"firstname": {
"description": "Firstname",
"type": "string",
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'IWS',
'description': '',
'type': 'object',
'required': ['firstname', 'lastname', 'email_notif', 'date', 'token'],
'properties': {
'firstname': {
'description': 'Firstname',
'type': 'string',
},
"lastname": {
"description": "Lastname",
"type": "string",
'lastname': {
'description': 'Lastname',
'type': 'string',
},
"email": {
"description": "Email",
"type": "string",
'email': {
'description': 'Email',
'type': 'string',
},
"email_notif": {
"description": "Email notification",
"type": "boolean",
'email_notif': {
'description': 'Email notification',
'type': 'boolean',
},
"description": {
"description": "Description of the request",
"type": "string",
'description': {
'description': 'Description of the request',
'type': 'string',
},
"tel_number": {
"description": "Telephone number",
"type": "string",
'tel_number': {
'description': 'Telephone number',
'type': 'string',
},
"date": {
"description": "Booking date",
"type": "string",
'date': {
'description': 'Booking date',
'type': 'string',
},
"token": {
"description": "Booking token",
"type": "string",
'token': {
'description': 'Booking token',
'type': 'string',
},
"sms": {
"description": "Send sms to user before the booked date",
'sms': {
'description': 'Send sms to user before the booked date',
},
},
}
@ -103,7 +103,7 @@ class IWSConnector(BaseResource):
client.set_default_soapheaders([header_value])
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)
ArrayOfIsiWsDataField = client.get_type('%sArrayOfIsiWsDataField' % NS)
IsiWsDataField = client.get_type('%sIsiWsDataField' % NS)
@ -123,13 +123,13 @@ class IWSConnector(BaseResource):
try:
tree = lxml.etree.fromstring(iws_res.encode('utf-8'), parser).getroottree()
except lxml.etree.XMLSyntaxError:
raise APIError("IWS response is not valid")
result = {"status": tree.find('//Statut').text, "trace": tree.find('//Trace').text}
raise APIError('IWS response is not valid')
result = {'status': tree.find('//Statut').text, 'trace': tree.find('//Trace').text}
fields = {}
for data_field in tree.xpath('//IsiWsDataField'):
fields[data_field.find('IsiField').text] = data_field.find('IsiValue').text
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
def _check_status(self, iws_res):
@ -168,7 +168,7 @@ class IWSConnector(BaseResource):
'I_AP_COMMUNE': city,
'I_AP_COMMUNEINTER': sti_code,
'J_PRJACTPREV': '5',
'C_EQUIPE': "VPVIGIE",
'C_EQUIPE': 'VPVIGIE',
'I_APP_DEMANDEUR': 'booking, demandeur',
'I_AP_ADRESSEMAIL': 'booking@localhost',
'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()
date_obj = datetime.strptime(raw_date, '%d/%m/%Y').date()
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
@endpoint(

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -16,7 +16,7 @@
CONCILIATION_INDIVIDU = {
'block': {'name': 'Individu', 'pk': "PK/IndexIndividu/@V"},
'block': {'name': 'Individu', 'pk': 'PK/IndexIndividu/@V'},
'criteria': {
5: (
{
@ -56,23 +56,23 @@ CONCILIATION_INDIVIDU = {
'EtatCivil/NomJeuneFille/@V': 'nom',
},
'output': [
"Dossier/PK/IndexDossier/@V",
"PK/IndexIndividu/@V",
"EtatCivil/Nom/@V",
"EtatCivil/NomJeuneFille/@V",
"EtatCivil/Prenom/@V",
"EtatCivil/DateNaissance/@V",
"Dossier/Adresse/NumeroLieu/@V",
"Dossier/Adresse/NatureLieu/@Lc",
"Dossier/Adresse/NomLieu/@V",
"Dossier/Adresse/ComplementLieu/@V",
"Dossier/Adresse/CpLieu/@V",
"Dossier/Adresse/Commune/NomCom/@V",
'Dossier/PK/IndexDossier/@V',
'PK/IndexIndividu/@V',
'EtatCivil/Nom/@V',
'EtatCivil/NomJeuneFille/@V',
'EtatCivil/Prenom/@V',
'EtatCivil/DateNaissance/@V',
'Dossier/Adresse/NumeroLieu/@V',
'Dossier/Adresse/NatureLieu/@Lc',
'Dossier/Adresse/NomLieu/@V',
'Dossier/Adresse/ComplementLieu/@V',
'Dossier/Adresse/CpLieu/@V',
'Dossier/Adresse/Commune/NomCom/@V',
],
}
CONCILIATION_INDIVIDU_SANS_DN = {
'block': {'name': 'Individu', 'pk': "PK/IndexIndividu/@V"},
'block': {'name': 'Individu', 'pk': 'PK/IndexIndividu/@V'},
'criteria': {
5: (
{
@ -103,23 +103,23 @@ CONCILIATION_INDIVIDU_SANS_DN = {
'EtatCivil/NomJeuneFille/@V': 'nom',
},
'output': [
"Dossier/PK/IndexDossier/@V",
"PK/IndexIndividu/@V",
"EtatCivil/Nom/@V",
"EtatCivil/NomJeuneFille/@V",
"EtatCivil/Prenom/@V",
"EtatCivil/DateNaissance/@V",
"Dossier/Adresse/NumeroLieu/@V",
"Dossier/Adresse/NatureLieu/@Lc",
"Dossier/Adresse/NomLieu/@V",
"Dossier/Adresse/ComplementLieu/@V",
"Dossier/Adresse/CpLieu/@V",
"Dossier/Adresse/Commune/NomCom/@V",
'Dossier/PK/IndexDossier/@V',
'PK/IndexIndividu/@V',
'EtatCivil/Nom/@V',
'EtatCivil/NomJeuneFille/@V',
'EtatCivil/Prenom/@V',
'EtatCivil/DateNaissance/@V',
'Dossier/Adresse/NumeroLieu/@V',
'Dossier/Adresse/NatureLieu/@Lc',
'Dossier/Adresse/NomLieu/@V',
'Dossier/Adresse/ComplementLieu/@V',
'Dossier/Adresse/CpLieu/@V',
'Dossier/Adresse/Commune/NomCom/@V',
],
}
CONCILIATION_ADRESSE = {
'block': {'name': 'Adresse', 'pk': "CodeLieu/@V"},
'block': {'name': 'Adresse', 'pk': 'CodeLieu/@V'},
'criteria': {
5: (
{
@ -135,18 +135,18 @@ CONCILIATION_ADRESSE = {
'Commune/PK/CodeCommune/@V': 'commune',
},
'output': [
"CodeLieu/@V",
"NatureLieu/@Lc",
"NomLieu/@V",
"CodePostal/@V",
"Commune/PK/CodeCommune/@V",
"Commune/NomCom/@V",
"CodeDepartement/@V",
'CodeLieu/@V',
'NatureLieu/@Lc',
'NomLieu/@V',
'CodePostal/@V',
'Commune/PK/CodeCommune/@V',
'Commune/NomCom/@V',
'CodeDepartement/@V',
],
}
CONCILIATION_PARTICULIER = {
'block': {'name': 'Particulier', 'pk': "PK/IndexParticulier/@V"},
'block': {'name': 'Particulier', 'pk': 'PK/IndexParticulier/@V'},
'criteria': {
5: (
{
@ -177,23 +177,23 @@ CONCILIATION_PARTICULIER = {
'EtatCivil/NomJeuneFille/@V': 'nom',
},
'output': [
"PK/IndexParticulier/@V",
"EtatCivil/Nom/@V",
"EtatCivil/NomJeuneFille/@V",
"EtatCivil/Prenom/@V",
"EtatCivil/DateNaissance/@V",
"Adresse/NumeroLieu/@V",
"Adresse/NatureLieu/@Lc",
"Adresse/NomLieu/@V",
"Adresse/ComplementLieu/@V",
"Adresse/CpLieu/@V",
"Adresse/Commune/NomCom/@V",
'PK/IndexParticulier/@V',
'EtatCivil/Nom/@V',
'EtatCivil/NomJeuneFille/@V',
'EtatCivil/Prenom/@V',
'EtatCivil/DateNaissance/@V',
'Adresse/NumeroLieu/@V',
'Adresse/NatureLieu/@Lc',
'Adresse/NomLieu/@V',
'Adresse/ComplementLieu/@V',
'Adresse/CpLieu/@V',
'Adresse/Commune/NomCom/@V',
],
}
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 = []
for affinity, afflist in config['criteria'].items():
for aff in afflist:
@ -202,8 +202,8 @@ def conciliation_payload(config, **data):
criterium.append({'key': xpath, 'operator': op})
setting.append(
{
"affinity": affinity,
"Criterium": criterium,
'affinity': affinity,
'Criterium': criterium,
}
)
criterium = []
@ -214,16 +214,16 @@ def conciliation_payload(config, **data):
returndata.append(xpath)
return {
"ConciliationInputWS": {
"Block": block,
"Input": {
"Settings": {
"Setting": setting,
'ConciliationInputWS': {
'Block': block,
'Input': {
'Settings': {
'Setting': setting,
},
"Criteria": {"Criterium": criterium},
'Criteria': {'Criterium': criterium},
},
"Output": {
"ReturnDatas": {"returnData": returndata},
'Output': {
'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')
return {
"titulaireCompte": banque_titulaire,
"domiciliation": banque_domiciliation,
"codeBanque": banque_codebanque,
"codeGuichet": banque_codeguichet,
"numeroCompte": banque_numero,
"cleRib": banque_cle,
"modeReglement": 1,
'titulaireCompte': banque_titulaire,
'domiciliation': banque_domiciliation,
'codeBanque': banque_codebanque,
'codeGuichet': banque_codeguichet,
'numeroCompte': banque_numero,
'cleRib': banque_cle,
'modeReglement': 1,
}
@ -524,36 +524,36 @@ def get_patrimoine(fields, wf):
if immobilier_bati > 0 and revenus_annee:
message.append(
{
"Nomenclature": {"indexFamille": 2, "indexNature": 1},
"anneeReference": int(revenus_annee),
"valeurPrelevement": immobilier_bati,
'Nomenclature': {'indexFamille': 2, 'indexNature': 1},
'anneeReference': int(revenus_annee),
'valeurPrelevement': immobilier_bati,
}
)
if immobilier_non_bati > 0 and revenus_annee:
message.append(
{
"Nomenclature": {"indexFamille": 2, "indexNature": 2},
"anneeReference": int(revenus_annee),
"valeurPrelevement": immobilier_non_bati,
'Nomenclature': {'indexFamille': 2, 'indexNature': 2},
'anneeReference': int(revenus_annee),
'valeurPrelevement': immobilier_non_bati,
}
)
if prelevements > 0 and revenus_annee:
message.append(
{
"Nomenclature": {"indexFamille": 3, "indexNature": 1},
"anneeReference": int(revenus_annee),
"valeurPrelevement": prelevements,
'Nomenclature': {'indexFamille': 3, 'indexNature': 1},
'anneeReference': int(revenus_annee),
'valeurPrelevement': prelevements,
}
)
if fonciers > 0 and fonciers_annee:
message.append(
{
"Nomenclature": {"indexFamille": 4, "indexNature": 1},
"anneeReference": int(fonciers_annee),
"valeurPrelevement": fonciers,
'Nomenclature': {'indexFamille': 4, 'indexNature': 1},
'anneeReference': int(fonciers_annee),
'valeurPrelevement': fonciers,
}
)

View File

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

View File

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

View File

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

View File

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

View File

@ -183,7 +183,7 @@ SUBSCRIPTION_SCHEMA = {
},
},
'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': [
{'type': 'string'},
{'type': 'null'},

View File

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

View File

@ -17,7 +17,7 @@
PERSON_BANK_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#',
'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',
'required': ['bankBIC', 'bankIBAN', 'bankRUM', 'dateStart', 'bankAddress', 'lastName', 'firstName'],
'properties': {

View File

@ -89,7 +89,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
)
max_payment_delay = models.PositiveIntegerField(
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'
@ -538,13 +538,13 @@ class ToulouseMaelis(BaseResource, HTTPResource):
def assert_key_in_referential(self, referential_name, key_value, keys_text, required=True):
if not key_value:
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
try:
self.referential.get(referential_name=referential_name, item_id=key_value)
except Referential.DoesNotExist:
ref_text = "required " if required else ""
ref_text = ref_text + "referential"
ref_text = 'required ' if required else ''
ref_text = ref_text + 'referential'
raise APIError(
"%s key value '%s' do not belong to '%s' %s"
% (keys_text, key_value, referential_name, ref_text)
@ -993,7 +993,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
display_category='Famille',
description="Lister les situations professionnelles",
description='Lister les situations professionnelles',
name='read-professional-situation-list',
parameters={
'id': {'description': 'Identifiant de lenregistrement'},
@ -1141,7 +1141,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
display_category='Famille',
description="Rechercher un dossier famille",
description='Rechercher un dossier famille',
name='search-family',
parameters={
'q': {'description': 'Recherche en texte intégral'},
@ -1164,7 +1164,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
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',
parameters={
'q': {'description': 'Numéro de DUI'},
@ -1199,7 +1199,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
display_category='Famille',
description="Lister les responsables légaux",
description='Lister les responsables légaux',
name='read-rl-list',
parameters={
'NameID': {'description': 'Publik NameID'},
@ -1245,7 +1245,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
display_category='Famille',
description="Lister les enfants",
description='Lister les enfants',
name='read-child-list',
parameters={
'NameID': {'description': 'Publik NameID'},
@ -1262,7 +1262,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
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',
parameters={
'NameID': {'description': 'Publik NameID'},
@ -1317,7 +1317,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
display_category='Famille',
description="Obtenir les informations sur un responsable légal",
description='Obtenir les informations sur un responsable légal',
name='read-rl',
parameters={
'rl_id': {'description': 'Numéro du responsable légal'},
@ -1357,7 +1357,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
display_category='Famille',
description="Obtenir les informations sur un enfant",
description='Obtenir les informations sur un enfant',
name='read-child',
parameters={
'child_id': {'description': "Numéro de l'enfant"},
@ -1410,17 +1410,17 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
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',
parameters={
'person_id': {'description': "Numéro du responsable légal ou de l'enfant"},
'NameID': {'description': 'Publik NameID'},
'family_id': {'description': 'Numéro de DUI'},
'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': {
'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',
},
'school_year': {
@ -1636,7 +1636,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
display_category='Famille',
description="Ajouter un enfant",
description='Ajouter un enfant',
name='create-child',
parameters={
'NameID': {'description': 'Publik NameID'},
@ -1667,7 +1667,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
display_category='Famille',
description="Modifier un enfant",
description='Modifier un enfant',
name='update-child',
parameters={
'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",
name='update-quotient',
parameters={
'rl_id': {'description': "Numéro du responsable légal"},
'rl_id': {'description': 'Numéro du responsable légal'},
'NameID': {'description': 'Publik NameID'},
'family_id': {'description': 'Numéro de DUI'},
},
@ -2024,7 +2024,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
display_category='Famille',
description="Ajouter une vaccination à un enfant",
description='Ajouter une vaccination à un enfant',
name='update-child-add-vaccination',
parameters={
'child_id': {'description': "Numéro de l'enfant"},
@ -2093,7 +2093,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
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',
parameters={
'NameID': {'description': 'Publik NameID'},
@ -2101,7 +2101,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
'numPerson': {'description': "Numéro du responsable légal ou de l'enfant"},
'code': {'description': 'Code de la pièce'},
'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',
},
},
@ -2475,7 +2475,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
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',
parameters={
'NameID': {'description': 'Publik NameID'},
@ -2522,7 +2522,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
display_category='Inscriptions',
description="Lister les années scolaires",
description='Lister les années scolaires',
name='read-school-years-list',
)
def read_school_years_list(self, request):
@ -2530,7 +2530,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
display_category='Inscriptions',
description="Lister les niveaux scolaires",
description='Lister les niveaux scolaires',
name='read-school-levels-list',
parameters={
'age': {'description': 'Âge de l\'enfant', 'example_value': '6'},
@ -2544,7 +2544,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
display_category='Inscriptions',
description="Lister les motifs de dérogation",
description='Lister les motifs de dérogation',
name='read-exemption-reasons-list',
)
def read_exemption_reasons_list(self, request):
@ -2552,7 +2552,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
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',
parameters={
'year': {'description': 'Année', 'example_value': '2022'},
@ -2580,7 +2580,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
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',
parameters={
'year': {'description': 'Année', 'example_value': '2023'},
@ -2634,7 +2634,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
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',
post={
'request_body': {'schema': {'application/json': family_schemas.SCHOOL_PRE_REGISTRATION_SCHEMA}}
@ -2646,7 +2646,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
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',
post={
'request_body': {
@ -2660,7 +2660,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
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',
post={
'request_body': {
@ -2674,7 +2674,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
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',
parameters={
'ref_date': {
@ -2802,16 +2802,16 @@ class ToulouseMaelis(BaseResource, HTTPResource):
parameters={
'person_id': {'description': "Numéro du responsable légal ou de l'enfant"},
'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': {
'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',
},
'start_date': {'description': 'Début de la période'},
'end_date': {'description': 'Fin de la période'},
'text_template': {
'description': "Gabarit utilisé pour la valeur text (URL encoding)",
'description': 'Gabarit utilisé pour la valeur text (URL encoding)',
'example_value': '{{ activity.libelle2 }}',
},
},
@ -2975,24 +2975,24 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
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',
parameters={
'NameID': {'description': 'Publik NameID'},
'family_id': {'description': 'Numéro de DUI'},
'person_id': {'description': "Numéro du responsable légal ou de l'enfant"},
'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': {
'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',
},
'start_date': {'description': 'Début de la période'},
'end_date': {'description': 'Fin de la période'},
'activity_id': {'description': "Numéro de l'activité"},
'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(
@ -3096,11 +3096,11 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
display_category='Inscriptions',
description="Lister les natures des activités",
description='Lister les natures des activités',
name='read-activity-nature-list',
parameters={
'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',
},
},
@ -3127,7 +3127,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
display_category='Inscriptions',
description="Lister les directions de la ville",
description='Lister les directions de la ville',
name='read-direction-list',
)
def read_direction_list(self, request):
@ -3135,9 +3135,9 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
display_category='Inscriptions',
description="Lister les services de la ville",
description='Lister les services de la ville',
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):
queryset = self.referential.filter(referential_name='Service')
@ -3147,7 +3147,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
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',
)
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"},
'activity_id': {'description': "Numéro de l'activité"},
'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'},
'family_id': {'description': 'Numéro de DUI'},
'ref_date': {'description': 'Date du début du calcul'},
@ -3367,7 +3367,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
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',
post={
'request_body': {
@ -3440,7 +3440,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
display_category='Inscriptions',
description="Ajouter une inscription extra-scolaire ou loisir",
description='Ajouter une inscription extra-scolaire ou loisir',
name='add-person-subscription',
post={
'request_body': {
@ -3677,7 +3677,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
display_category='Inscriptions',
description="Obtenir les paniers de la famille",
description='Obtenir les paniers de la famille',
name='get-baskets',
parameters={
'NameID': {'description': 'Publik NameID'},
@ -3697,7 +3697,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
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',
parameters={
'NameID': {'description': 'Publik NameID'},
@ -3714,7 +3714,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
display_category='Inscriptions',
description="Supprimer une ligne du panier",
description='Supprimer une ligne du panier',
name='delete-basket-line',
parameters={
'NameID': {'description': 'Publik NameID'},
@ -3742,7 +3742,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
display_category='Inscriptions',
description="Supprimer le panier de la famille",
description='Supprimer le panier de la famille',
name='delete-basket',
parameters={
'NameID': {'description': 'Publik NameID'},
@ -3766,7 +3766,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
display_category='Inscriptions',
description="Valider le panier de la famille",
description='Valider le panier de la famille',
name='validate-basket',
parameters={
'NameID': {'description': 'Publik NameID'},
@ -3803,7 +3803,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
display_category='Inscriptions',
description="Lister les crèches",
description='Lister les crèches',
name='read-nursery-list',
parameters={
'activity_type': {'description': "Type de l'activité.", 'example_value': 'CRECHCO'},
@ -3831,7 +3831,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
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',
parameters={
'activity_type': {'description': "Type de l'activité.", 'example_value': 'CRECHCO'},
@ -3879,7 +3879,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
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',
post={'request_body': {'schema': {'application/json': family_schemas.NURSERY_DEMAND_SCHEMA}}},
)
@ -3957,7 +3957,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
@endpoint(
display_category='Facture',
description="Lister les régies",
description='Lister les régies',
name='read-regie-list',
)
def read_regie_list(self, request):
@ -4444,7 +4444,7 @@ class Subscription(models.Model):
if self.status() == 'removed':
self.wcs_trigger_payload['err_desc'] = "Le panier n'a pas été validé"
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.resource.add_job(
'trigger_subscription_job',

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -34,7 +34,7 @@ def check(args):
print(res)
if __name__ == "__main__":
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors')
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