diff --git a/combo_plugin_gnm/management/commands/gnm_update_settings.py b/combo_plugin_gnm/management/commands/gnm_update_settings.py index 1ead3aa..7bfb798 100644 --- a/combo_plugin_gnm/management/commands/gnm_update_settings.py +++ b/combo_plugin_gnm/management/commands/gnm_update_settings.py @@ -55,7 +55,7 @@ class Command(BaseCommand): GNM_REPORTING = True - COMBO_MAP_TILE_URLTEMPLATE = "https://tiles.entrouvert.org/hdm/{z}/{x}/{y}.png" + COMBO_MAP_TILE_URLTEMPLATE = 'https://tiles.entrouvert.org/hdm/{z}/{x}/{y}.png' COMBO_MAP_ATTRIBUTION = "© OpenStreetMap" COMBO_GEOCODING_SERVICE = 'https://nominatim.entrouvert.org' @@ -63,590 +63,590 @@ class Command(BaseCommand): JSON_CELL_TYPES = self.settings_json.get('JSON_CELL_TYPES.update') or {} JSON_CELL_TYPES = { - "velov": { - "url": "https://%(data_username)s:%(data_password)s@download.data.grandlyon.com/ws/rdata/jcd_jcdecaux.jcdvelov/all.json?field=gid&value=[gid]" + 'velov': { + 'url': 'https://%(data_username)s:%(data_password)s@download.data.grandlyon.com/ws/rdata/jcd_jcdecaux.jcdvelov/all.json?field=gid&value=[gid]' % settings.DATA_CREDENTIALS, - "name": "Velov", - "cache_duration": 60, - "force_async": False, - "auto_refresh": 90, - "toodego:tile": True, - "form": [{"varname": "gid", "type": "string", "label": "GID de la station"}], + 'name': 'Velov', + 'cache_duration': 60, + 'force_async': False, + 'auto_refresh': 90, + 'toodego:tile': True, + 'form': [{'varname': 'gid', 'type': 'string', 'label': 'GID de la station'}], }, - "taxi": { - "url": "{{passerelle_url}}opengis/data-grandlyon-general/query/taxi/?property:gid={{gid}}", - "name": "Station de taxi", - "cache_duration": 86400, - "force_async": False, - "toodego:tile": True, - "form": [{"varname": "gid", "type": "string", "label": "GID de la station"}], + 'taxi': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-general/query/taxi/?property:gid={{gid}}', + 'name': 'Station de taxi', + 'cache_duration': 86400, + 'force_async': False, + 'toodego:tile': True, + 'form': [{'varname': 'gid', 'type': 'string', 'label': 'GID de la station'}], }, - "mdr": { - "url": "{{passerelle_url}}opengis/data-grandlyon-general/query/mdr/?property:identifiant={{identifiant}}", - "cache_duration": 86400, - "force_async": False, - "name": "Maison de la Métropole de Lyon", - "toodego:page": True, - "toodego:tile": True, - "form": [{"varname": "identifiant", "type": "string", "label": "Identifiant"}], + 'mdr': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-general/query/mdr/?property:identifiant={{identifiant}}', + 'cache_duration': 86400, + 'force_async': False, + 'name': 'Maison de la Métropole de Lyon', + 'toodego:page': True, + 'toodego:tile': True, + 'form': [{'varname': 'identifiant', 'type': 'string', 'label': 'Identifiant'}], }, - "piscine": { - "url": "{{passerelle_url}}opengis/data-grandlyon-general/query/piscine/?property:identifiant={{identifiant}}", - "cache_duration": 86400, - "force_async": False, - "name": "Piscine de la Métropole de Lyon", - "toodego:page": True, - "toodego:tile": True, - "form": [{"varname": "identifiant", "type": "string", "label": "Identifiant"}], + 'piscine': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-general/query/piscine/?property:identifiant={{identifiant}}', + 'cache_duration': 86400, + 'force_async': False, + 'name': 'Piscine de la Métropole de Lyon', + 'toodego:page': True, + 'toodego:tile': True, + 'form': [{'varname': 'identifiant', 'type': 'string', 'label': 'Identifiant'}], }, - "mairie": { - "url": "{{passerelle_url}}opengis/data-grandlyon-general/query/mairie/?property:identifiant={{identifiant}}", - "cache_duration": 86400, - "force_async": False, - "name": "Mairie", - "toodego:page": True, - "toodego:tile": True, - "form": [{"varname": "identifiant", "type": "string", "label": "Identifiant"}], + 'mairie': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-general/query/mairie/?property:identifiant={{identifiant}}', + 'cache_duration': 86400, + 'force_async': False, + 'name': 'Mairie', + 'toodego:page': True, + 'toodego:tile': True, + 'form': [{'varname': 'identifiant', 'type': 'string', 'label': 'Identifiant'}], }, - "decheterie": { - "url": "{{passerelle_url}}opengis/data-grandlyon-general/query/decheterie/?property:identifiant={{identifiant}}", - "cache_duration": 86400, - "force_async": False, - "name": "Déchèterie", - "toodego:page": True, - "toodego:page-title-template": "Déchèterie {{properties.nom}}", - "toodego:tile": True, - "form": [{"varname": "identifiant", "type": "string", "label": "Identifiant"}], + 'decheterie': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-general/query/decheterie/?property:identifiant={{identifiant}}', + 'cache_duration': 86400, + 'force_async': False, + 'name': 'Déchèterie', + 'toodego:page': True, + 'toodego:page-title-template': 'Déchèterie {{properties.nom}}', + 'toodego:tile': True, + 'form': [{'varname': 'identifiant', 'type': 'string', 'label': 'Identifiant'}], }, - "donnerie": { - "url": "{{passerelle_url}}opengis/data-grandlyon-general/query/donnerie/?property:identifiant={{identifiant}}", - "cache_duration": 86400, - "force_async": False, - "name": "Donnerie", - "toodego:page": True, - "toodego:page-title-template": "Donnerie {{properties.nom}}", - "toodego:tile": True, - "form": [{"varname": "identifiant", "type": "string", "label": "Identifiant"}], + 'donnerie': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-general/query/donnerie/?property:identifiant={{identifiant}}', + 'cache_duration': 86400, + 'force_async': False, + 'name': 'Donnerie', + 'toodego:page': True, + 'toodego:page-title-template': 'Donnerie {{properties.nom}}', + 'toodego:tile': True, + 'form': [{'varname': 'identifiant', 'type': 'string', 'label': 'Identifiant'}], }, - "bibliotheque": { - "url": "{{passerelle_url}}opengis/data-grandlyon-general/query/bibliotheque/?property:identifiant={{identifiant}}", - "cache_duration": 86400, - "force_async": False, - "name": "Bibliothèque", - "toodego:page": True, - "toodego:tile": True, - "form": [{"varname": "identifiant", "type": "string", "label": "Identifiant"}], + 'bibliotheque': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-general/query/bibliotheque/?property:identifiant={{identifiant}}', + 'cache_duration': 86400, + 'force_async': False, + 'name': 'Bibliothèque', + 'toodego:page': True, + 'toodego:tile': True, + 'form': [{'varname': 'identifiant', 'type': 'string', 'label': 'Identifiant'}], }, - "aire-de-covoiturage": { - "url": "{{passerelle_url}}opengis/data-grandlyon-general/query/aire-de-covoiturage/?property:gid={{gid}}", - "cache_duration": 86400, - "force_async": False, - "name": "Aire de covoiturage", - "toodego:tile": True, - "form": [{"varname": "gid", "type": "string", "label": "Identifiant"}], + 'aire-de-covoiturage': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-general/query/aire-de-covoiturage/?property:gid={{gid}}', + 'cache_duration': 86400, + 'force_async': False, + 'name': 'Aire de covoiturage', + 'toodego:tile': True, + 'form': [{'varname': 'gid', 'type': 'string', 'label': 'Identifiant'}], }, - "cinema": { - "url": "{{passerelle_url}}opengis/data-grandlyon-general/query/cinema/?property:gid={{gid}}", - "name": "Cinéma", - "cache_duration": 86400, - "force_async": False, - "toodego:tile": True, - "form": [{"varname": "gid", "type": "string", "label": "GID du cinéma"}], + 'cinema': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-general/query/cinema/?property:gid={{gid}}', + 'name': 'Cinéma', + 'cache_duration': 86400, + 'force_async': False, + 'toodego:tile': True, + 'form': [{'varname': 'gid', 'type': 'string', 'label': 'GID du cinéma'}], }, - "musee": { - "url": "{{passerelle_url}}opengis/data-grandlyon-general/query/musee/?property:gid={{gid}}", - "name": "Musée", - "cache_duration": 86400, - "force_async": False, - "toodego:page": False, - "toodego:tile": True, - "form": [{"varname": "gid", "type": "string", "label": "GID du musée"}], + 'musee': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-general/query/musee/?property:gid={{gid}}', + 'name': 'Musée', + 'cache_duration': 86400, + 'force_async': False, + 'toodego:page': False, + 'toodego:tile': True, + 'form': [{'varname': 'gid', 'type': 'string', 'label': 'GID du musée'}], }, - "parc-et-jardin-ponctuel": { - "url": "{{passerelle_url}}opengis/data-grandlyon-general/query/parc-et-jardin-ponctuel/?property:gid={{gid}}", - "name": "Parc ou jardin", - "cache_duration": 86400, - "force_async": False, - "toodego:page": False, - "toodego:tile": True, - "form": [{"varname": "gid", "type": "string", "label": "GID du parc ou jardin"}], + 'parc-et-jardin-ponctuel': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-general/query/parc-et-jardin-ponctuel/?property:gid={{gid}}', + 'name': 'Parc ou jardin', + 'cache_duration': 86400, + 'force_async': False, + 'toodego:page': False, + 'toodego:tile': True, + 'form': [{'varname': 'gid', 'type': 'string', 'label': 'GID du parc ou jardin'}], }, - "airquality": { - "url": "{% if q_lat or lat %}https://api.atmo-aura.fr/partenaires/v2/indice_request?longitude={% firstof q_lon lon %}&latitude={% firstof q_lat lat %}&" + 'airquality': { + 'url': '{% if q_lat or lat %}https://api.atmo-aura.fr/partenaires/v2/indice_request?longitude={% firstof q_lon lon %}&latitude={% firstof q_lat lat %}&' + atmo_api_token - + "{% endif %}", - "cache_duration": 300, - "force_async": False, - "name": "Qualité de l'air", + + '{% endif %}', + 'cache_duration': 300, + 'force_async': False, + 'name': "Qualité de l'air", 'toodego:tile': 'air', - "form": [ + 'form': [ { - "varname": "lat", - "type": "string", - "label": "Latitude", - "required": False, + 'varname': 'lat', + 'type': 'string', + 'label': 'Latitude', + 'required': False, }, { - "varname": "lon", - "type": "string", - "label": "Longitude", - "required": False, + 'varname': 'lon', + 'type': 'string', + 'label': 'Longitude', + 'required': False, }, ], - "additional-data": [ + 'additional-data': [ { - "key": "air2go", - "url": "{% if q_lat or lat %}" - "https://api.atmo-aura.fr/partenaires/v2/indice_request?" - "longitude={% firstof q_lon lon %}&latitude={% firstof q_lat lat %}" - "{% else %}" + 'key': 'air2go', + 'url': '{% if q_lat or lat %}' + 'https://api.atmo-aura.fr/partenaires/v2/indice_request?' + 'longitude={% firstof q_lon lon %}&latitude={% firstof q_lat lat %}' + '{% else %}' "{% now \"Y-m-d\" as today %}" "{% with today|add_days:\"-1\"|date:\"Y-m-d\" as yesterday %}" - "https://api.atmo-aura.fr/api/v1/communes/69123/indices/atmo?date_debut_echeance={{yesterday}}" - "{% endwith %}{% endif %}&" + atmo_api_token, + 'https://api.atmo-aura.fr/api/v1/communes/69123/indices/atmo?date_debut_echeance={{yesterday}}' + '{% endwith %}{% endif %}&' + atmo_api_token, }, { - "key": "definitions", - "url": "https://api.atmo-aura.fr/api/v1/indices/atmo/definitions?" + atmo_api_token, - "cache_duration": 86400, + 'key': 'definitions', + 'url': 'https://api.atmo-aura.fr/api/v1/indices/atmo/definitions?' + atmo_api_token, + 'cache_duration': 86400, }, { - "key": "vigilances", - "url": "https://api.atmo-aura.fr/api/v1/communes/69123/vigilances?date=now&" + 'key': 'vigilances', + 'url': 'https://api.atmo-aura.fr/api/v1/communes/69123/vigilances?date=now&' + atmo_api_token, - "cache_duration": 300, + 'cache_duration': 300, }, { - "key": "nominatim", - "url": "{% if q_lat or lat %}{{passerelle_url}}base-adresse/nominatim/reverse?lat={% firstof q_lat lat %}&lon={% firstof q_lon lon %}&format=json{% endif %}", - "cache_duration": 3600, + 'key': 'nominatim', + 'url': '{% if q_lat or lat %}{{passerelle_url}}base-adresse/nominatim/reverse?lat={% firstof q_lat lat %}&lon={% firstof q_lon lon %}&format=json{% endif %}', + 'cache_duration': 3600, }, { - "key": "places", - "url": "{% if user_nameid %}{{ passerelle_url }}jsondatastore/lieux-favoris/data/?name_id={{user_nameid}}{% endif %}", + 'key': 'places', + 'url': '{% if user_nameid %}{{ passerelle_url }}jsondatastore/lieux-favoris/data/?name_id={{user_nameid}}{% endif %}', }, { - "key": "place_geoloc", - "url": "{% if places %}{{ passerelle_url }}base-adresse/nominatim/search?q={{ places.data.0.text }}&format=json{% endif %}", - "cache_duration": 3600, + 'key': 'place_geoloc', + 'url': '{% if places %}{{ passerelle_url }}base-adresse/nominatim/search?q={{ places.data.0.text }}&format=json{% endif %}', + 'cache_duration': 3600, }, { - "key": "place2_geoloc", - "url": "{% if places|length > 1 %}{{ passerelle_url }}base-adresse/nominatim/search?q={{ places.data.1.text }}&format=json{% endif %}", - "cache_duration": 3600, + 'key': 'place2_geoloc', + 'url': '{% if places|length > 1 %}{{ passerelle_url }}base-adresse/nominatim/search?q={{ places.data.1.text }}&format=json{% endif %}', + 'cache_duration': 3600, }, ], - "actions": { - "geocode": { - "url": "{{ passerelle_url }}base-adresse/nominatim/search?q={{ q }}&format=json", - "method": "get", - "response": "raw", + 'actions': { + 'geocode': { + 'url': '{{ passerelle_url }}base-adresse/nominatim/search?q={{ q }}&format=json', + 'method': 'get', + 'response': 'raw', } }, }, - "pollen": { - "url": "https://download.data.grandlyon.com/ws/rdata/rnsa_reseau_aerobio.rnsabulletin/all.json", - "cache_duration": 300, - "force_async": False, - "name": "Info Pollen", - "toodego:tile": True, - "additional-data": [ + 'pollen': { + 'url': 'https://download.data.grandlyon.com/ws/rdata/rnsa_reseau_aerobio.rnsabulletin/all.json', + 'cache_duration': 300, + 'force_async': False, + 'name': 'Info Pollen', + 'toodego:tile': True, + 'additional-data': [ { - "key": "syntheses", - "url": "https://download.data.grandlyon.com/ws/rdata/rnsa_reseau_aerobio.rnsabulletin/all.json?field=type&value=Synthese", + 'key': 'syntheses', + 'url': 'https://download.data.grandlyon.com/ws/rdata/rnsa_reseau_aerobio.rnsabulletin/all.json?field=type&value=Synthese', } ], }, - "places": { - "url": "{{passerelle_url}}jsondatastore/lieux-favoris/data/?name_id={{user_nameid}}", - "name": "Lieux favoris", - "force_async": False, - "cache_duration": 600, - "additional-data": [{"key": "userdata", "url": "{{idp_url}}api/users/{{user_nameid}}"}], - "actions": { - "create": { - "url": "{{passerelle_url}}jsondatastore/lieux-favoris/data/create?name_id={{user_nameid}}" + 'places': { + 'url': '{{passerelle_url}}jsondatastore/lieux-favoris/data/?name_id={{user_nameid}}', + 'name': 'Lieux favoris', + 'force_async': False, + 'cache_duration': 600, + 'additional-data': [{'key': 'userdata', 'url': '{{idp_url}}api/users/{{user_nameid}}'}], + 'actions': { + 'create': { + 'url': '{{passerelle_url}}jsondatastore/lieux-favoris/data/create?name_id={{user_nameid}}' }, - "update": { - "url": "{{passerelle_url}}jsondatastore/lieux-favoris/data/{{id}}/?name_id={{user_nameid}}" + 'update': { + 'url': '{{passerelle_url}}jsondatastore/lieux-favoris/data/{{id}}/?name_id={{user_nameid}}' }, - "delete": { - "url": "{{passerelle_url}}jsondatastore/lieux-favoris/data/{{id}}/delete?name_id={{user_nameid}}" + 'delete': { + 'url': '{{passerelle_url}}jsondatastore/lieux-favoris/data/{{id}}/delete?name_id={{user_nameid}}' }, }, }, - "silo-a-verre": { - "url": "{{passerelle_url}}opengis/data-grandlyon-general/query/silo-a-verre/?property:identifiant={{identifiant}}", - "cache_duration": 86400, - "force_async": False, - "name": "Silo à verre", - "toodego:tile": True, - "form": [{"varname": "identifiant", "type": "string", "label": "Identifiant"}], + 'silo-a-verre': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-general/query/silo-a-verre/?property:identifiant={{identifiant}}', + 'cache_duration': 86400, + 'force_async': False, + 'name': 'Silo à verre', + 'toodego:tile': True, + 'form': [{'varname': 'identifiant', 'type': 'string', 'label': 'Identifiant'}], }, - "tcl": { - "url": "{{passerelle_url}}tcl/tcl/stop/{{id}}", - "auto_refresh": 25, - "cache_duration": 10, - "force_async": False, - "name": "Arrêt TCL", - "toodego:tile": True, - "form": [{"varname": "id", "type": "string", "label": "Identifiant"}], + 'tcl': { + 'url': '{{passerelle_url}}tcl/tcl/stop/{{id}}', + 'auto_refresh': 25, + 'cache_duration': 10, + 'force_async': False, + 'name': 'Arrêt TCL', + 'toodego:tile': True, + 'form': [{'varname': 'id', 'type': 'string', 'label': 'Identifiant'}], }, - "goto": { - "url": "{% load l10n %}{% localize off %}{% if lat1 %}{{cityway_api_url}}api/journeyplanner/opt/PlanTrips/json?DepartureType=COORDINATES&DepartureLatitude={{lat1}}&DepartureLongitude={{lng1}}&ArrivalType=COORDINATES&ArrivalLatitude={{lat2}}&ArrivalLongitude={{lng2}}&Date={{date}}&DateType=DEPARTURE&TripModes={{tripmode}}&Algorithm=FASTEST&BikeSecurityLevel=None&BikeSpeed=12&WalkSpeed=4&MaxCarDistance=100&MaxBikeDistance=100&MaxWalkDistance=3000&AvoidDisruptions=1&StopToPlaceCar=1&SpecificOptions=GetOn;3|GetOff;4|TinyDistance;300|VLS;0|CARSHARING;0&UserId={% firstof cityway_api_userid 'toodego' %}&user_key={{cityway_api_userkey}}{% endif %}{% endlocalize %}", - "cache_duration": 60, - "force_async": False, - "name": "M'y rendre", - "loading-message": 'Calcul…', - "varnames": ["lat1", "lng1", "lat2", "lng2", "date", "to"], - "form": [ + 'goto': { + 'url': "{% load l10n %}{% localize off %}{% if lat1 %}{{cityway_api_url}}api/journeyplanner/opt/PlanTrips/json?DepartureType=COORDINATES&DepartureLatitude={{lat1}}&DepartureLongitude={{lng1}}&ArrivalType=COORDINATES&ArrivalLatitude={{lat2}}&ArrivalLongitude={{lng2}}&Date={{date}}&DateType=DEPARTURE&TripModes={{tripmode}}&Algorithm=FASTEST&BikeSecurityLevel=None&BikeSpeed=12&WalkSpeed=4&MaxCarDistance=100&MaxBikeDistance=100&MaxWalkDistance=3000&AvoidDisruptions=1&StopToPlaceCar=1&SpecificOptions=GetOn;3|GetOff;4|TinyDistance;300|VLS;0|CARSHARING;0&UserId={% firstof cityway_api_userid 'toodego' %}&user_key={{cityway_api_userkey}}{% endif %}{% endlocalize %}", + 'cache_duration': 60, + 'force_async': False, + 'name': "M'y rendre", + 'loading-message': 'Calcul…', + 'varnames': ['lat1', 'lng1', 'lat2', 'lng2', 'date', 'to'], + 'form': [ { - "varname": "tripmode", - "type": "string", - "label": "Mode de transport (WALK, BIKE, PT, CAR)", + 'varname': 'tripmode', + 'type': 'string', + 'label': 'Mode de transport (WALK, BIKE, PT, CAR)', } ], }, - "cut-profile": { - "url": "{{idp_url}}api/users/{{user_nameid}}/", - "name": "Profil CUT", - "auto_refresh": 60, + 'cut-profile': { + 'url': '{{idp_url}}api/users/{{user_nameid}}/', + 'name': 'Profil CUT', + 'auto_refresh': 60, }, - "profile-info": {"url": "{{idp_url}}api/users/{{user_nameid}}/", "name": "Infos de profil"}, - "suggestions": { - "name": "Suggestions", - "url": "{{idp_url}}api/users/{{user_nameid}}", - "force_async": True, - "loading-message": "Assemblage en cours, quelques secondes…", - "additional-data": [ + 'profile-info': {'url': '{{idp_url}}api/users/{{user_nameid}}/', 'name': 'Infos de profil'}, + 'suggestions': { + 'name': 'Suggestions', + 'url': '{{idp_url}}api/users/{{user_nameid}}', + 'force_async': True, + 'loading-message': 'Assemblage en cours, quelques secondes…', + 'additional-data': [ { - "key": "places", - "url": "{{passerelle_url}}jsondatastore/lieux-favoris/data/?name_id={{user_nameid}}", + 'key': 'places', + 'url': '{{passerelle_url}}jsondatastore/lieux-favoris/data/?name_id={{user_nameid}}', } ], }, - "alerte-qualite-de-l-air": { - "url": "{{passerelle_url}}feeds/alertes-qualite-de-lair/json", - "cache_duration": 600, - "force_async": True, - "name": "Alerte qualité de l'air", + 'alerte-qualite-de-l-air': { + 'url': '{{passerelle_url}}feeds/alertes-qualite-de-lair/json', + 'cache_duration': 600, + 'force_async': True, + 'name': "Alerte qualité de l'air", }, - "mairie-usager": { - "name": "Mairie de l'usager", - "url": "{{idp_url}}api/users/{{user_nameid}}/", - "form": [{"varname": "text", "type": "text", "label": "Texte"}], + 'mairie-usager': { + 'name': "Mairie de l'usager", + 'url': '{{idp_url}}api/users/{{user_nameid}}/', + 'form': [{'varname': 'text', 'type': 'text', 'label': 'Texte'}], }, - "group-title": { - "name": "Intertitre", - "url": "{{}}", - "form": [{"varname": "text", "type": "text", "label": "Texte"}], + 'group-title': { + 'name': 'Intertitre', + 'url': '{{}}', + 'form': [{'varname': 'text', 'type': 'text', 'label': 'Texte'}], }, - "stats": { - "name": "Statistiques tuiles", - "url": "{{portal_url}}api/dashboard/tile-stats/", + 'stats': { + 'name': 'Statistiques tuiles', + 'url': '{{portal_url}}api/dashboard/tile-stats/', }, - "parkingtr": { - "url": "https://%(data_username)s:%(data_password)s@download.data.grandlyon.com/wfs/rdata?SERVICE=WFS&VERSION=2.0.0&outputformat=GEOJSON&request=GetFeature&typename=pvo_patrimoine_voirie.pvoparkingtr&filter=pkgid[pkgid]" + 'parkingtr': { + 'url': 'https://%(data_username)s:%(data_password)s@download.data.grandlyon.com/wfs/rdata?SERVICE=WFS&VERSION=2.0.0&outputformat=GEOJSON&request=GetFeature&typename=pvo_patrimoine_voirie.pvoparkingtr&filter=pkgid[pkgid]' % settings.DATA_CREDENTIALS, - "cache_duration": 86400, - "force_async": False, - "name": "Parking", - "toodego:tile": True, - "form": [{"varname": "pkgid", "type": "string", "label": "Identifiant"}], + 'cache_duration': 86400, + 'force_async': False, + 'name': 'Parking', + 'toodego:tile': True, + 'form': [{'varname': 'pkgid', 'type': 'string', 'label': 'Identifiant'}], }, - "parc-velo": { - "url": "{{passerelle_url}}opengis/data-grandlyon-general/query/parc-velo/?property:gid={{gid}}", - "cache_duration": 86400, - "force_async": False, - "name": "Parc de stationnement vélos", - "toodego:tile": True, - "form": [{"varname": "gid", "type": "string", "label": "Identifiant"}], + 'parc-velo': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-general/query/parc-velo/?property:gid={{gid}}', + 'cache_duration': 86400, + 'force_async': False, + 'name': 'Parc de stationnement vélos', + 'toodego:tile': True, + 'form': [{'varname': 'gid', 'type': 'string', 'label': 'Identifiant'}], }, - "autopartage": { - "url": "{{passerelle_url}}opengis/data-grandlyon-general/query/autopartage/?property:gid={{gid}}", - "cache_duration": 86400, - "force_async": False, - "name": "Autopartage", - "toodego:tile": True, - "form": [{"varname": "gid", "type": "string", "label": "Identifiant"}], + 'autopartage': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-general/query/autopartage/?property:gid={{gid}}', + 'cache_duration': 86400, + 'force_async': False, + 'name': 'Autopartage', + 'toodego:tile': True, + 'form': [{'varname': 'gid', 'type': 'string', 'label': 'Identifiant'}], }, - "stationnement-pmr": { - "url": "{{passerelle_url}}opengis/data-grandlyon-general/query/stationnement-pmr/?property:gid={{gid}}", - "cache_duration": 86400, - "force_async": False, - "name": "Stationnement réglementé pour les PMR", - "toodego:tile": "pmr", - "form": [{"varname": "gid", "type": "string", "label": "Identifiant"}], + 'stationnement-pmr': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-general/query/stationnement-pmr/?property:gid={{gid}}', + 'cache_duration': 86400, + 'force_async': False, + 'name': 'Stationnement réglementé pour les PMR', + 'toodego:tile': 'pmr', + 'form': [{'varname': 'gid', 'type': 'string', 'label': 'Identifiant'}], }, - "toilette": { - "url": "{{passerelle_url}}opengis/data-grandlyon-general/query/toilette/?property:gid={{gid}}", - "cache_duration": 86400, - "force_async": False, - "name": "Toilette publique", - "toodego:tile": True, - "form": [{"varname": "gid", "type": "string", "label": "gid"}], + 'toilette': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-general/query/toilette/?property:gid={{gid}}', + 'cache_duration': 86400, + 'force_async': False, + 'name': 'Toilette publique', + 'toodego:tile': True, + 'form': [{'varname': 'gid', 'type': 'string', 'label': 'gid'}], }, - "evenement-routier": { - "url": "https://%(data_username)s:%(data_password)s@download.data.grandlyon.com/wfs/rdata?SERVICE=WFS&VERSION=2.0.0&outputformat=GEOJSON&request=GetFeature&typename=pvo_patrimoine_voirie.pvoevenement&filter=id[id]" + 'evenement-routier': { + 'url': 'https://%(data_username)s:%(data_password)s@download.data.grandlyon.com/wfs/rdata?SERVICE=WFS&VERSION=2.0.0&outputformat=GEOJSON&request=GetFeature&typename=pvo_patrimoine_voirie.pvoevenement&filter=id[id]' % settings.DATA_CREDENTIALS, - "cache_duration": 86400, - "force_async": False, - "name": "Evenement routier", - "toodego:tile": True, - "form": [{"varname": "id", "type": "string", "label": "Identifiant"}], + 'cache_duration': 86400, + 'force_async': False, + 'name': 'Evenement routier', + 'toodego:tile': True, + 'form': [{'varname': 'id', 'type': 'string', 'label': 'Identifiant'}], }, - "cartads-dossiers": { - "url": "{{passerelle_url}}grandlyon-cartads-cs/{{slug}}/files?name_id={{user_nameid}}", - "cache_duration": 0, - "force_async": True, - "name": "Dossiers Cart@DS", - "form": [{"varname": "slug", "type": "string", "label": "Slug du connecteur"}], - "actions": { - "unsubscribe": { - "url": "{{passerelle_url}}grandlyon-cartads-cs/{{slug}}/unsubscribe?name_id={{user_nameid}}", + 'cartads-dossiers': { + 'url': '{{passerelle_url}}grandlyon-cartads-cs/{{slug}}/files?name_id={{user_nameid}}', + 'cache_duration': 0, + 'force_async': True, + 'name': 'Dossiers Cart@DS', + 'form': [{'varname': 'slug', 'type': 'string', 'label': 'Slug du connecteur'}], + 'actions': { + 'unsubscribe': { + 'url': '{{passerelle_url}}grandlyon-cartads-cs/{{slug}}/unsubscribe?name_id={{user_nameid}}', }, }, }, - "urgence-sanitaire-soins": { - "url": "{{passerelle_url}}opengis/data-grandlyon-rdata/query/urgence-sanitaire-soins/?property:gid={{gid}}", - "cache_duration": 86400, - "force_async": False, - "name": "Urgence sanitaire Covid 19 - Accès aux soins", - "toodego:page": True, - "toodego:tile": True, - "template-name": "combo/json/urgence-sanitaire.html", - "form": [{"varname": "gid", "type": "string", "label": "gid"}], + 'urgence-sanitaire-soins': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-rdata/query/urgence-sanitaire-soins/?property:gid={{gid}}', + 'cache_duration': 86400, + 'force_async': False, + 'name': 'Urgence sanitaire Covid 19 - Accès aux soins', + 'toodego:page': True, + 'toodego:tile': True, + 'template-name': 'combo/json/urgence-sanitaire.html', + 'form': [{'varname': 'gid', 'type': 'string', 'label': 'gid'}], }, - "urgence-sanitaire-alimentation": { - "url": "{{passerelle_url}}opengis/data-grandlyon-rdata/query/urgence-sanitaire-alimentation/?property:gid={{gid}}", - "cache_duration": 86400, - "force_async": False, - "name": "Urgence sanitaire Covid 19 - Alimentation", - "toodego:page": True, - "toodego:tile": True, - "template-name": "combo/json/urgence-sanitaire.html", - "form": [{"varname": "gid", "type": "string", "label": "gid"}], + 'urgence-sanitaire-alimentation': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-rdata/query/urgence-sanitaire-alimentation/?property:gid={{gid}}', + 'cache_duration': 86400, + 'force_async': False, + 'name': 'Urgence sanitaire Covid 19 - Alimentation', + 'toodego:page': True, + 'toodego:tile': True, + 'template-name': 'combo/json/urgence-sanitaire.html', + 'form': [{'varname': 'gid', 'type': 'string', 'label': 'gid'}], }, - "urgence-sanitaire-hebergement": { - "url": "{{passerelle_url}}opengis/data-grandlyon-rdata/query/urgence-sanitaire-hebergement/?property:gid={{gid}}", - "cache_duration": 86400, - "force_async": False, - "name": "Urgence sanitaire Covid 19 - Hébergement", - "toodego:page": True, - "toodego:tile": True, - "template-name": "combo/json/urgence-sanitaire.html", - "form": [{"varname": "gid", "type": "string", "label": "gid"}], + 'urgence-sanitaire-hebergement': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-rdata/query/urgence-sanitaire-hebergement/?property:gid={{gid}}', + 'cache_duration': 86400, + 'force_async': False, + 'name': 'Urgence sanitaire Covid 19 - Hébergement', + 'toodego:page': True, + 'toodego:tile': True, + 'template-name': 'combo/json/urgence-sanitaire.html', + 'form': [{'varname': 'gid', 'type': 'string', 'label': 'gid'}], }, - "urgence-sanitaire-quotidien": { - "url": "{{passerelle_url}}opengis/data-grandlyon-rdata/query/urgence-sanitaire-quotidien/?property:gid={{gid}}", - "cache_duration": 86400, - "force_async": False, - "name": "Urgence sanitaire Covid 19 - Services au quotidien", - "toodego:page": True, - "toodego:tile": True, - "template-name": "combo/json/urgence-sanitaire.html", - "form": [{"varname": "gid", "type": "string", "label": "gid"}], + 'urgence-sanitaire-quotidien': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-rdata/query/urgence-sanitaire-quotidien/?property:gid={{gid}}', + 'cache_duration': 86400, + 'force_async': False, + 'name': 'Urgence sanitaire Covid 19 - Services au quotidien', + 'toodego:page': True, + 'toodego:tile': True, + 'template-name': 'combo/json/urgence-sanitaire.html', + 'form': [{'varname': 'gid', 'type': 'string', 'label': 'gid'}], }, - "commerce-animaux-jardin-bricolage": { - "url": "{{passerelle_url}}opengis/data-grandlyon-rdata/query/commerce-animaux-jardin-bricolage/?property:gid={{gid}}", - "cache_duration": 86400, - "force_async": False, - "name": "Commerce - Animaux jardin bricolage", - "toodego:page": True, - "toodego:tile": True, - "template-name": "combo/json/commerce.html", - "form": [{"varname": "gid", "type": "string", "label": "gid"}], + 'commerce-animaux-jardin-bricolage': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-rdata/query/commerce-animaux-jardin-bricolage/?property:gid={{gid}}', + 'cache_duration': 86400, + 'force_async': False, + 'name': 'Commerce - Animaux jardin bricolage', + 'toodego:page': True, + 'toodego:tile': True, + 'template-name': 'combo/json/commerce.html', + 'form': [{'varname': 'gid', 'type': 'string', 'label': 'gid'}], }, - "commerce-autres-activites": { - "url": "{{passerelle_url}}opengis/data-grandlyon-rdata/query/commerce-autres-activites/?property:gid={{gid}}", - "cache_duration": 86400, - "force_async": False, - "name": "Commerce - Autres activités", - "toodego:page": True, - "toodego:tile": True, - "template-name": "combo/json/commerce.html", - "form": [{"varname": "gid", "type": "string", "label": "gid"}], + 'commerce-autres-activites': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-rdata/query/commerce-autres-activites/?property:gid={{gid}}', + 'cache_duration': 86400, + 'force_async': False, + 'name': 'Commerce - Autres activités', + 'toodego:page': True, + 'toodego:tile': True, + 'template-name': 'combo/json/commerce.html', + 'form': [{'varname': 'gid', 'type': 'string', 'label': 'gid'}], }, - "commerce-deco-meubles": { - "url": "{{passerelle_url}}opengis/data-grandlyon-rdata/query/commerce-deco-meubles/?property:gid={{gid}}", - "cache_duration": 86400, - "force_async": False, - "name": "Commerce - Déco meubles", - "toodego:page": True, - "toodego:tile": True, - "template-name": "combo/json/commerce.html", - "form": [{"varname": "gid", "type": "string", "label": "gid"}], + 'commerce-deco-meubles': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-rdata/query/commerce-deco-meubles/?property:gid={{gid}}', + 'cache_duration': 86400, + 'force_async': False, + 'name': 'Commerce - Déco meubles', + 'toodego:page': True, + 'toodego:tile': True, + 'template-name': 'combo/json/commerce.html', + 'form': [{'varname': 'gid', 'type': 'string', 'label': 'gid'}], }, - "commerce-fleuriste": { - "url": "{{passerelle_url}}opengis/data-grandlyon-rdata/query/commerce-fleuriste/?property:gid={{gid}}", - "cache_duration": 86400, - "force_async": False, - "name": "Commerce - Fleuriste", - "toodego:page": True, - "toodego:tile": True, - "template-name": "combo/json/commerce.html", - "form": [{"varname": "gid", "type": "string", "label": "gid"}], + 'commerce-fleuriste': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-rdata/query/commerce-fleuriste/?property:gid={{gid}}', + 'cache_duration': 86400, + 'force_async': False, + 'name': 'Commerce - Fleuriste', + 'toodego:page': True, + 'toodego:tile': True, + 'template-name': 'combo/json/commerce.html', + 'form': [{'varname': 'gid', 'type': 'string', 'label': 'gid'}], }, - "commerce-jeux-jouets": { - "url": "{{passerelle_url}}opengis/data-grandlyon-rdata/query/commerce-jeux-jouets/?property:gid={{gid}}", - "cache_duration": 86400, - "force_async": False, - "name": "Commerce - Jeux jouets", - "toodego:page": True, - "toodego:tile": True, - "template-name": "combo/json/commerce.html", - "form": [{"varname": "gid", "type": "string", "label": "gid"}], + 'commerce-jeux-jouets': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-rdata/query/commerce-jeux-jouets/?property:gid={{gid}}', + 'cache_duration': 86400, + 'force_async': False, + 'name': 'Commerce - Jeux jouets', + 'toodego:page': True, + 'toodego:tile': True, + 'template-name': 'combo/json/commerce.html', + 'form': [{'varname': 'gid', 'type': 'string', 'label': 'gid'}], }, - "commerce-librairie": { - "url": "{{passerelle_url}}opengis/data-grandlyon-rdata/query/commerce-librairie/?property:gid={{gid}}", - "cache_duration": 86400, - "force_async": False, - "name": "Commerce - Librairie", - "toodego:page": True, - "toodego:tile": True, - "template-name": "combo/json/commerce.html", - "form": [{"varname": "gid", "type": "string", "label": "gid"}], + 'commerce-librairie': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-rdata/query/commerce-librairie/?property:gid={{gid}}', + 'cache_duration': 86400, + 'force_async': False, + 'name': 'Commerce - Librairie', + 'toodego:page': True, + 'toodego:tile': True, + 'template-name': 'combo/json/commerce.html', + 'form': [{'varname': 'gid', 'type': 'string', 'label': 'gid'}], }, - "commerce-mode": { - "url": "{{passerelle_url}}opengis/data-grandlyon-rdata/query/commerce-mode/?property:gid={{gid}}", - "cache_duration": 86400, - "force_async": False, - "name": "Commerce - Mode", - "toodego:page": True, - "toodego:tile": True, - "template-name": "combo/json/commerce.html", - "form": [{"varname": "gid", "type": "string", "label": "gid"}], + 'commerce-mode': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-rdata/query/commerce-mode/?property:gid={{gid}}', + 'cache_duration': 86400, + 'force_async': False, + 'name': 'Commerce - Mode', + 'toodego:page': True, + 'toodego:tile': True, + 'template-name': 'combo/json/commerce.html', + 'form': [{'varname': 'gid', 'type': 'string', 'label': 'gid'}], }, - "commerce-restauration": { - "url": "{{passerelle_url}}opengis/data-grandlyon-rdata/query/commerce-restauration/?property:gid={{gid}}", - "cache_duration": 86400, - "force_async": False, - "name": "Commerce - Restauration", - "toodego:page": True, - "toodego:tile": True, - "template-name": "combo/json/commerce.html", - "form": [{"varname": "gid", "type": "string", "label": "gid"}], + 'commerce-restauration': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-rdata/query/commerce-restauration/?property:gid={{gid}}', + 'cache_duration': 86400, + 'force_async': False, + 'name': 'Commerce - Restauration', + 'toodego:page': True, + 'toodego:tile': True, + 'template-name': 'combo/json/commerce.html', + 'form': [{'varname': 'gid', 'type': 'string', 'label': 'gid'}], }, - "commerce-soins-institut-beaute": { - "url": "{{passerelle_url}}opengis/data-grandlyon-rdata/query/commerce-soins-institut-beaute/?property:gid={{gid}}", - "cache_duration": 86400, - "force_async": False, - "name": "Commerce - Soins institut beauté", - "toodego:page": True, - "toodego:tile": True, - "template-name": "combo/json/commerce.html", - "form": [{"varname": "gid", "type": "string", "label": "gid"}], + 'commerce-soins-institut-beaute': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-rdata/query/commerce-soins-institut-beaute/?property:gid={{gid}}', + 'cache_duration': 86400, + 'force_async': False, + 'name': 'Commerce - Soins institut beauté', + 'toodego:page': True, + 'toodego:tile': True, + 'template-name': 'combo/json/commerce.html', + 'form': [{'varname': 'gid', 'type': 'string', 'label': 'gid'}], }, - "commerce-sport-loisirs": { - "url": "{{passerelle_url}}opengis/data-grandlyon-rdata/query/commerce-sport-loisirs/?property:gid={{gid}}", - "cache_duration": 86400, - "force_async": False, - "name": "Commerce - Sport loisirs", - "toodego:page": True, - "toodego:tile": True, - "template-name": "combo/json/commerce.html", - "form": [{"varname": "gid", "type": "string", "label": "gid"}], + 'commerce-sport-loisirs': { + 'url': '{{passerelle_url}}opengis/data-grandlyon-rdata/query/commerce-sport-loisirs/?property:gid={{gid}}', + 'cache_duration': 86400, + 'force_async': False, + 'name': 'Commerce - Sport loisirs', + 'toodego:page': True, + 'toodego:tile': True, + 'template-name': 'combo/json/commerce.html', + 'form': [{'varname': 'gid', 'type': 'string', 'label': 'gid'}], }, - "rsj-a-traiter": { - "url": "{{eservices_url}}api/forms/?limit={% firstof limit 100 %}{% if category_id %}&category_id={{ category_id }}{% endif %}&NameID={{user_nameid}}", - "cache_duration": 120, - "name": "Demandes à traiter (RSJ)", - "form": [ - {"varname": "limit", "type": "string", "label": "Nombre max de demandes"}, - {"varname": "category_id", "type": "string", "label": "Identifiant de la catégorie"}, + 'rsj-a-traiter': { + 'url': '{{eservices_url}}api/forms/?limit={% firstof limit 100 %}{% if category_id %}&category_id={{ category_id }}{% endif %}&NameID={{user_nameid}}', + 'cache_duration': 120, + 'name': 'Demandes à traiter (RSJ)', + 'form': [ + {'varname': 'limit', 'type': 'string', 'label': 'Nombre max de demandes'}, + {'varname': 'category_id', 'type': 'string', 'label': 'Identifiant de la catégorie'}, ], }, - "rsj-fiche": { - "url": "{{eservices_url}}api/cards/jeunes-rsa/{{jeunes_rsa_id}}/", - "name": "Fiche RSJ", - "cache_duration": 120, + 'rsj-fiche': { + 'url': '{{eservices_url}}api/cards/jeunes-rsa/{{jeunes_rsa_id}}/', + 'name': 'Fiche RSJ', + 'cache_duration': 120, }, - "caluire-famille": { - "cache_duration": 30, - "force_async": True, - "name": "Caluire-et-Cuire - Teamnet Axel: Infos famille", - "url": "{{ passerelle_url }}caluire-axel/{{ slug }}/family_info?NameID={{ user_nameid }}", - "form": [{"label": "Identifiant du connecteur", "varname": "slug", "required": True}], + 'caluire-famille': { + 'cache_duration': 30, + 'force_async': True, + 'name': 'Caluire-et-Cuire - Teamnet Axel: Infos famille', + 'url': '{{ passerelle_url }}caluire-axel/{{ slug }}/family_info?NameID={{ user_nameid }}', + 'form': [{'label': 'Identifiant du connecteur', 'varname': 'slug', 'required': True}], }, - "caluire-responsables": { - "cache_duration": 30, - "force_async": True, - "name": "Caluire-et-Cuire - Teamnet Axel: Infos responsables", - "url": "{{ passerelle_url }}caluire-axel/{{ slug }}/family_info?NameID={{ user_nameid }}", - "form": [{"label": "Identifiant du connecteur", "varname": "slug", "required": True}], + 'caluire-responsables': { + 'cache_duration': 30, + 'force_async': True, + 'name': 'Caluire-et-Cuire - Teamnet Axel: Infos responsables', + 'url': '{{ passerelle_url }}caluire-axel/{{ slug }}/family_info?NameID={{ user_nameid }}', + 'form': [{'label': 'Identifiant du connecteur', 'varname': 'slug', 'required': True}], }, - "caluire-liste-enfants": { - "cache_duration": 30, - "force_async": True, - "name": "Caluire-et-Cuire - Teamnet Axel: Liste des enfants (repeat)", - "url": "{{ passerelle_url }}caluire-axel/{{ slug }}/children_info?NameID={{ user_nameid }}", - "make_global": "list_children", - "form": [{"label": "Identifiant du connecteur", "varname": "slug", "required": True}], + 'caluire-liste-enfants': { + 'cache_duration': 30, + 'force_async': True, + 'name': 'Caluire-et-Cuire - Teamnet Axel: Liste des enfants (repeat)', + 'url': '{{ passerelle_url }}caluire-axel/{{ slug }}/children_info?NameID={{ user_nameid }}', + 'make_global': 'list_children', + 'form': [{'label': 'Identifiant du connecteur', 'varname': 'slug', 'required': True}], }, - "caluire-enfant": { - "cache_duration": 0, - "force_async": True, - "name": "Caluire-et-Cuire - Teamnet Axel: Enfant (repeat)", - "url": "{{ passerelle_url }}caluire-axel/{{ slug }}/child_info?NameID={{ user_nameid }}&idpersonne={{ list_children.data|get:repeat_index|get:'id' }}", - "repeat": "{{ list_children.data|length }}", - "additional-data": [ + 'caluire-enfant': { + 'cache_duration': 0, + 'force_async': True, + 'name': 'Caluire-et-Cuire - Teamnet Axel: Enfant (repeat)', + 'url': "{{ passerelle_url }}caluire-axel/{{ slug }}/child_info?NameID={{ user_nameid }}&idpersonne={{ list_children.data|get:repeat_index|get:'id' }}", + 'repeat': '{{ list_children.data|length }}', + 'additional-data': [ { - "key": "schooling", - "url": "{{ passerelle_url }}caluire-axel/{{ slug }}/child_schooling_info?" + 'key': 'schooling', + 'url': '{{ passerelle_url }}caluire-axel/{{ slug }}/child_schooling_info?' "NameID={{ user_nameid }}&idpersonne={{ list_children.data|get:repeat_index|get:'id' }}&schooling_date={% now 'Y-m-d' %}", }, { - "key": "activities", - "url": "{{ passerelle_url }}caluire-axel/{{ slug }}/child_activities_info?" + 'key': 'activities', + 'url': '{{ passerelle_url }}caluire-axel/{{ slug }}/child_activities_info?' "NameID={{ user_nameid }}&idpersonne={{ list_children.data|get:repeat_index|get:'id' }}&schooling_date={% now 'Y-m-d' %}", }, ], - "form": [ - {"label": "Identifiant du connecteur", "varname": "slug", "required": True}, + 'form': [ + {'label': 'Identifiant du connecteur', 'varname': 'slug', 'required': True}, ], }, - "caluire-enfant-detail": { - "cache_duration": 30, - "force_async": True, - "name": "Caluire-et-Cuire - Teamnet Axel: Enfant", - "url": "{{ passerelle_url }}caluire-axel/{{ slug }}/child_info?NameID={{ user_nameid }}&idpersonne={{ child_id }}", - "form": [ - {"label": "Identifiant du connecteur", "varname": "slug", "required": True}, + 'caluire-enfant-detail': { + 'cache_duration': 30, + 'force_async': True, + 'name': 'Caluire-et-Cuire - Teamnet Axel: Enfant', + 'url': '{{ passerelle_url }}caluire-axel/{{ slug }}/child_info?NameID={{ user_nameid }}&idpersonne={{ child_id }}', + 'form': [ + {'label': 'Identifiant du connecteur', 'varname': 'slug', 'required': True}, ], }, - "caluire-enfant-prochaines-inscriptions": { - "cache_duration": 0, - "force_async": True, - "name": "Caluire-et-Cuire - Teamnet Axel: Prochaines inscriptions", - "url": "{% now 'n' as current_month %}{% if current_month in '678' %}" - "{{ passerelle_url }}caluire-axel/{{ slug }}/child_activities_info?NameID={{ user_nameid }}&idpersonne={{ child_id }}" + 'caluire-enfant-prochaines-inscriptions': { + 'cache_duration': 0, + 'force_async': True, + 'name': 'Caluire-et-Cuire - Teamnet Axel: Prochaines inscriptions', + 'url': "{% now 'n' as current_month %}{% if current_month in '678' %}" + '{{ passerelle_url }}caluire-axel/{{ slug }}/child_activities_info?NameID={{ user_nameid }}&idpersonne={{ child_id }}' "&schooling_date={% now 'Y' as current_year %}{{ current_year|add:'1' }}-{% now 'm-d' %}{% endif %}", - "form": [ - {"label": "Identifiant du connecteur", "varname": "slug", "required": True}, + 'form': [ + {'label': 'Identifiant du connecteur', 'varname': 'slug', 'required': True}, ], }, - "caluire-enfant-agenda": { - "cache_duration": 0, - "force_async": True, - "name": "Caluire-et-Cuire - Teamnet Axel: Agenda", - "url": "{{ passerelle_url }}caluire-axel/{{ slug }}/get_agenda_full?NameID={{ user_nameid }}&idpersonne={{ child_id }}" + 'caluire-enfant-agenda': { + 'cache_duration': 0, + 'force_async': True, + 'name': 'Caluire-et-Cuire - Teamnet Axel: Agenda', + 'url': '{{ passerelle_url }}caluire-axel/{{ slug }}/get_agenda_full?NameID={{ user_nameid }}&idpersonne={{ child_id }}' "{% now 'Y' as current_year %}{% now 'n' as current_month %}" "&start_date={% if current_month in '87654321' %}{{ current_year|add:'-1' }}{% else %}{{ current_year }}{% endif %}-09-01" "&end_date={% if current_month in '87654321' %}{{ current_year }}{% else %}{{ current_year|add:'1' }}{% endif %}-08-31", - "form": [ - {"label": "Identifiant du connecteur", "varname": "slug", "required": True}, + 'form': [ + {'label': 'Identifiant du connecteur', 'varname': 'slug', 'required': True}, ], }, - "caluire-enfant-agenda-next-year": { - "cache_duration": 0, - "force_async": True, - "name": "Caluire-et-Cuire - Teamnet Axel: Agenda prochaine année scolaire", - "url": "{% now 'Y' as current_year %}{% now 'n' as current_month %}{% if current_month in '678' %}" - "{{ passerelle_url }}caluire-axel/{{ slug }}/get_agenda_full?NameID={{ user_nameid }}&idpersonne={{ child_id }}" + 'caluire-enfant-agenda-next-year': { + 'cache_duration': 0, + 'force_async': True, + 'name': 'Caluire-et-Cuire - Teamnet Axel: Agenda prochaine année scolaire', + 'url': "{% now 'Y' as current_year %}{% now 'n' as current_month %}{% if current_month in '678' %}" + '{{ passerelle_url }}caluire-axel/{{ slug }}/get_agenda_full?NameID={{ user_nameid }}&idpersonne={{ child_id }}' "&start_date={% if current_month in '87654321' %}{{ current_year }}{% else %}{{ current_year|add:'1' }}{% endif %}-09-01" "&end_date={% if current_month in '87654321' %}{{ current_year|add:'1' }}{% else %}{{ current_year|add:'2' }}{% endif %}-08-31{% endif %}", - "form": [ - {"label": "Identifiant du connecteur", "varname": "slug", "required": True}, + 'form': [ + {'label': 'Identifiant du connecteur', 'varname': 'slug', 'required': True}, ], }, } @@ -658,81 +658,81 @@ class Command(BaseCommand): 'tcl': 'TCL', 'toodego': 'Toodego', 'velov': "Velo'v", - 'vivrou': "Vivro", + 'vivrou': 'Vivro', 'grandlyon': 'Grand Lyon', - 'bluely': "Bluely", - 'citiz-lpa': "Citiz LPA", - 'sncf': "SNCF", - 'effia': "EFFIA", - 'indigo': "Indigo", - 'lpa': "LPA", - 'sas-parc-opera': "SAS Parc Opera", - 'q-park': "Q-Park", - 'unibail': "Unibail", - 'sajr': "sajr", - 'aeroport-saint-exupe': "Aéroport Saint Exupe", + 'bluely': 'Bluely', + 'citiz-lpa': 'Citiz LPA', + 'sncf': 'SNCF', + 'effia': 'EFFIA', + 'indigo': 'Indigo', + 'lpa': 'LPA', + 'sas-parc-opera': 'SAS Parc Opera', + 'q-park': 'Q-Park', + 'unibail': 'Unibail', + 'sajr': 'sajr', + 'aeroport-saint-exupe': 'Aéroport Saint Exupe', } COLLECTIVITY_LABELS = { - "albigny-sur-saone": "Albigny-sur-Saône", - "bron": "Bron", - "cailloux-sur-fontaines": "Cailloux-sur-Fontaines", - "caluire-et-cuire": "Caluire-et-Cuire", - "champagne-au-mont-d-or": "Champagne-au-Mont-d'Or", - "charbonnieres-les-bains": "Charbonnières-les-Bains", - "charly": "Charly", - "chassie": "Chassie", - "collonges-au-mont-d-or": "Collonges-au-Mont-d'Or", - "corbas": "Corbas", - "couzon-au-mont-d-or": "Couzon-au-Mont-d'Or", - "craponne": "Craponne", - "curis-au-mont-d-or": "Curis-au-Mont-d'Or", - "dardilly": "Dardilly", - "decines-charpie": "Décines-Charpie", - "ecully": "Écully", - "feyzin": "Feyzin", - "fleurieu-sur-saone": "Fleurieu-sur-Saône", - "fontaines-saint-martin": "Fontaines-Saint-Martin", - "fontaines-sur-saone": "Fontaines-sur-Saône", - "francheville": "Francheville", - "genay": "Genay", - "givors": "Givors", - "grigny": "Grigny", - "irigny": "Irigny", - "jonage": "Jonage", - "la-mulatiere": "La Mulatière", - "la-tour-de-salvagny": "La Tour de Salvagny", - "limonest": "Limonest", - "lissie": "Lissie", - "lyon": "Lyon", - "marcy-l-etoile": "Marcy-l'Étoile", - "meyzie": "Meyzie", - "mions": "Mions", - "montanay": "Montanay", - "neuville-sur-saone": "Neuville-sur-Saône", - "oullins": "Oullins", - "pierre-benite": "Pierre-Bénite", - "poleymieux-au-mont-d-or": "Poleymieux-au-Mont-d'Or", - "quincieux": "Quincieux", - "rillieux-la-pape": "Rillieux-la-Pape", - "rochetaillee-sur-saone": "Rochetaillée-sur-Saône", - "saint-cyr-au-mont-d-or": "Saint-Cyr-au-Mont-d'Or", - "saint-didier-au-mont-d-or": "Saint-Didier-au-Mont-d'Or", - "saint-fons": "Saint-Fons", - "saint-genis-laval": "Saint-Genis-Laval", - "saint-genis-les-ollieres": "Saint-Genis-les-Ollières", - "saint-germain-au-mont-d-or": "Saint-Germain-au-Mont-d'Or", - "saint-priest": "Saint-Priest", - "sainte-foy-les-lyon": "Sainte-Foy-lès-Lyon", - "sathonay-camp": "Sathonay-Camp", - "sathonay-village": "Sathonay-Village", - "solaize": "Solaize", - "st-romain-au-mont-d-or": "Saint-Romain-au-Mont-d'Or", - "tassin-la-demi-lune": "Tassin-la-Demi-Lune", - "vaulx-en-velin": "Vaulx-en-Velin", - "venissieux": "Venissieux", - "vernaison": "Vernaison", - "villeurbanne": "Villeurbanne", + 'albigny-sur-saone': 'Albigny-sur-Saône', + 'bron': 'Bron', + 'cailloux-sur-fontaines': 'Cailloux-sur-Fontaines', + 'caluire-et-cuire': 'Caluire-et-Cuire', + 'champagne-au-mont-d-or': "Champagne-au-Mont-d'Or", + 'charbonnieres-les-bains': 'Charbonnières-les-Bains', + 'charly': 'Charly', + 'chassie': 'Chassie', + 'collonges-au-mont-d-or': "Collonges-au-Mont-d'Or", + 'corbas': 'Corbas', + 'couzon-au-mont-d-or': "Couzon-au-Mont-d'Or", + 'craponne': 'Craponne', + 'curis-au-mont-d-or': "Curis-au-Mont-d'Or", + 'dardilly': 'Dardilly', + 'decines-charpie': 'Décines-Charpie', + 'ecully': 'Écully', + 'feyzin': 'Feyzin', + 'fleurieu-sur-saone': 'Fleurieu-sur-Saône', + 'fontaines-saint-martin': 'Fontaines-Saint-Martin', + 'fontaines-sur-saone': 'Fontaines-sur-Saône', + 'francheville': 'Francheville', + 'genay': 'Genay', + 'givors': 'Givors', + 'grigny': 'Grigny', + 'irigny': 'Irigny', + 'jonage': 'Jonage', + 'la-mulatiere': 'La Mulatière', + 'la-tour-de-salvagny': 'La Tour de Salvagny', + 'limonest': 'Limonest', + 'lissie': 'Lissie', + 'lyon': 'Lyon', + 'marcy-l-etoile': "Marcy-l'Étoile", + 'meyzie': 'Meyzie', + 'mions': 'Mions', + 'montanay': 'Montanay', + 'neuville-sur-saone': 'Neuville-sur-Saône', + 'oullins': 'Oullins', + 'pierre-benite': 'Pierre-Bénite', + 'poleymieux-au-mont-d-or': "Poleymieux-au-Mont-d'Or", + 'quincieux': 'Quincieux', + 'rillieux-la-pape': 'Rillieux-la-Pape', + 'rochetaillee-sur-saone': 'Rochetaillée-sur-Saône', + 'saint-cyr-au-mont-d-or': "Saint-Cyr-au-Mont-d'Or", + 'saint-didier-au-mont-d-or': "Saint-Didier-au-Mont-d'Or", + 'saint-fons': 'Saint-Fons', + 'saint-genis-laval': 'Saint-Genis-Laval', + 'saint-genis-les-ollieres': 'Saint-Genis-les-Ollières', + 'saint-germain-au-mont-d-or': "Saint-Germain-au-Mont-d'Or", + 'saint-priest': 'Saint-Priest', + 'sainte-foy-les-lyon': 'Sainte-Foy-lès-Lyon', + 'sathonay-camp': 'Sathonay-Camp', + 'sathonay-village': 'Sathonay-Village', + 'solaize': 'Solaize', + 'st-romain-au-mont-d-or': "Saint-Romain-au-Mont-d'Or", + 'tassin-la-demi-lune': 'Tassin-la-Demi-Lune', + 'vaulx-en-velin': 'Vaulx-en-Velin', + 'venissieux': 'Venissieux', + 'vernaison': 'Vernaison', + 'villeurbanne': 'Villeurbanne', } PRODUCER_LABELS.update(COLLECTIVITY_LABELS) diff --git a/combo_plugin_gnm/templatetags/gnm.py b/combo_plugin_gnm/templatetags/gnm.py index bab3e4f..1d97df9 100644 --- a/combo_plugin_gnm/templatetags/gnm.py +++ b/combo_plugin_gnm/templatetags/gnm.py @@ -322,7 +322,7 @@ def get_mairie_opening_hours(mairie_data): period, all_day_hours = get_period_from_data(time_table) if all_day_hours and period == 'am': opening_hours_dict[weekday]['pm'] = '' # empty string to avoid displaying fermé - opening_hours_dict[weekday][period] = "%sh%s-%sh%s" % ( + opening_hours_dict[weekday][period] = '%sh%s-%sh%s' % ( time_table['start_hour'], time_table['start_minute'], time_table['end_hour'], @@ -413,7 +413,7 @@ def as_opening_hours_badge(data): slots[i] = None def format_time(hour, minute): - time = "%sh%02d" % (hour, minute) + time = '%sh%02d' % (hour, minute) if time == '0h00': time = 'minuit' return time @@ -434,7 +434,7 @@ def as_opening_hours_badge(data): day_label = 'demain' else: day_label = FR_WEEKDAYS[slots[0].start.weekday()] - if slots[0].start.strftime("%H:%M") == slots[0].end.strftime("%H:%M") == '00:00': + if slots[0].start.strftime('%H:%M') == slots[0].end.strftime('%H:%M') == '00:00': label = '%s %s 24h/24' % (verb, day_label) else: time = format_time(slots[0].start.hour, slots[0].start.minute) @@ -444,8 +444,8 @@ def as_opening_hours_badge(data): klass = 'soon-to-be-closed' else: klass = 'open' - if slots[0].start.strftime("%H:%M") == slots[0].end.strftime("%H:%M") == '00:00': - label = "Ouvert 24h/24" + if slots[0].start.strftime('%H:%M') == slots[0].end.strftime('%H:%M') == '00:00': + label = 'Ouvert 24h/24' else: time = format_time(slots[0].end.hour, slots[0].end.minute) label = "Ouvert jusqu'à %s" % time diff --git a/tests/test_as_opening_hours.py b/tests/test_as_opening_hours.py index 6196c96..ef484db 100644 --- a/tests/test_as_opening_hours.py +++ b/tests/test_as_opening_hours.py @@ -9,11 +9,11 @@ from combo_plugin_gnm.templatetags.gnm import EN_FULL_WEEKDAYS_LIST, FR_WEEKDAYS BASE_DIR = os.path.dirname(os.path.dirname(__file__)) GEOJSON = json.load(open(os.path.join(BASE_DIR, 'tests/data/mairie-geojson.json')))['features'] MDR_GEOJSON = json.load(open(os.path.join(BASE_DIR, 'tests/data/mdr-geojson.json')))['features'] -TZOFFSETS = {"Europe/Paris": 3600} +TZOFFSETS = {'Europe/Paris': 3600} @pytest.mark.freeze_time( - "2018-03-04 23:00:00", + '2018-03-04 23:00:00', ) def test_every_mairie_closed(): """every mairie is closed at mignight""" @@ -21,7 +21,7 @@ def test_every_mairie_closed(): assert len([x for x in opening_hours if 'open' in x]) == 0 -@pytest.mark.freeze_time("2018-03-04 23:00:00") +@pytest.mark.freeze_time('2018-03-04 23:00:00') def test_all_mairie_data_parsed_correct(): """everything got parsed correctly""" opening_hours = [ @@ -32,14 +32,14 @@ def test_all_mairie_data_parsed_correct(): assert opening_hours.count('') == 0 -@pytest.mark.freeze_time("2018-03-05 14:59:00") +@pytest.mark.freeze_time('2018-03-05 14:59:00') def test_empty_data(): """ "no data return the empty html""" test_html = as_opening_hours_badge(GEOJSON[0]['properties']) assert test_html == '' -@pytest.mark.freeze_time("2018-08-13 14:59:00") +@pytest.mark.freeze_time('2018-08-13 14:59:00') def test_mairie_bron_monday(): """S1326""" test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['identifiant'] == 'S1326'][0] @@ -47,15 +47,15 @@ def test_mairie_bron_monday(): assert test_html == mark_safe('
%s
' % (klass, label)) -@pytest.mark.freeze_time("2018-08-12 14:59:00") +@pytest.mark.freeze_time('2018-08-12 14:59:00') def test_mairie_bron_sunday(): """S1326""" test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['identifiant'] == 'S1326'][0] - klass, label = 'closed', "Réouvre demain à 8h00" + klass, label = 'closed', 'Réouvre demain à 8h00' assert test_html == mark_safe('
%s
' % (klass, label)) -@pytest.mark.freeze_time("2018-08-09 13:30:01") +@pytest.mark.freeze_time('2018-08-09 13:30:01') def test_mairie_sathonay_thursday_afternoon(): """S1326""" test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['identifiant'] == 'S1415'][0] @@ -63,15 +63,15 @@ def test_mairie_sathonay_thursday_afternoon(): assert test_html == mark_safe('
%s
' % (klass, label)) -@pytest.mark.freeze_time("2018-08-11 11:30:01") +@pytest.mark.freeze_time('2018-08-11 11:30:01') def test_mairie_saint_priest_closed(): """S1326""" test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['identifiant'] == 'S1406'][0] - klass, label = 'closed', "Réouvre lundi à 8h15" + klass, label = 'closed', 'Réouvre lundi à 8h15' assert test_html == mark_safe('
%s
' % (klass, label)) -@pytest.mark.freeze_time("2018-08-22 12:13:01") +@pytest.mark.freeze_time('2018-08-22 12:13:01') def test_mairie_saint_priest_open(): """S1326""" test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['identifiant'] == 'S1406'][0] @@ -79,17 +79,17 @@ def test_mairie_saint_priest_open(): assert test_html == mark_safe('
%s
' % (klass, label)) -@pytest.mark.freeze_time("2018-08-11 14:59:00") +@pytest.mark.freeze_time('2018-08-11 14:59:00') def test_mairie_bron_saturday(): """S1326""" test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['identifiant'] == 'S1326'][0] - klass, label = 'closed', "Réouvre lundi à 8h00" + klass, label = 'closed', 'Réouvre lundi à 8h00' assert test_html == mark_safe('
%s
' % (klass, label)) -@pytest.mark.freeze_time("2018-03-05 09:59:13") +@pytest.mark.freeze_time('2018-03-05 09:59:13') def test_jonage_open(): - "Jonage is defined only by openinghoursspecification data" + 'Jonage is defined only by openinghoursspecification data' test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['nom'] == 'Mairie de Jonage'][ 0 ] @@ -97,9 +97,9 @@ def test_jonage_open(): assert test_html == mark_safe('
%s
' % (klass, label)) -@pytest.mark.freeze_time("2018-03-05 11:32:00") +@pytest.mark.freeze_time('2018-03-05 11:32:00') def test_jonage_soon_to_be_closed(): - "Jonage is defined only by openinghoursspecification data" + 'Jonage is defined only by openinghoursspecification data' test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['nom'] == 'Mairie de Jonage'][ 0 ] @@ -107,17 +107,17 @@ def test_jonage_soon_to_be_closed(): assert test_html == mark_safe('
%s
' % (klass, label)) -@pytest.mark.freeze_time("2018-03-10 17:30:00") +@pytest.mark.freeze_time('2018-03-10 17:30:00') def test_jonage_closed(): - "Jonage is defined only by openinghoursspecification data" + 'Jonage is defined only by openinghoursspecification data' test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['nom'] == 'Mairie de Jonage'][ 0 ] - klass, label = 'closed', "Réouvre lundi à 8h30" + klass, label = 'closed', 'Réouvre lundi à 8h30' assert test_html == mark_safe('
%s
' % (klass, label)) -@pytest.mark.freeze_time("2018-03-05 15:55:00") +@pytest.mark.freeze_time('2018-03-05 15:55:00') def test_data_input_compatibility(): """as_opening_hours with a fixed datetime""" klass = 'open' @@ -128,7 +128,7 @@ def test_data_input_compatibility(): assert test_html == mark_safe('
%s
' % (klass, label)) -@pytest.mark.freeze_time("2018-03-05 00:00:00") +@pytest.mark.freeze_time('2018-03-05 00:00:00') def test_all_mdr_closed(): """every mdr is closed at mignight""" opening_hours = [as_opening_hours_badge(x) for x in MDR_GEOJSON] @@ -141,41 +141,41 @@ def test_all_mdr_data_parsed_correct(): assert opening_hours.count('') == 0 -@pytest.mark.freeze_time("2018-03-05 14:59:00") +@pytest.mark.freeze_time('2018-03-05 14:59:00') def test_mdr_open(): test_html = as_opening_hours_badge(MDR_GEOJSON[0]) klass, label = 'open', "Ouvert jusqu'à 16h45" assert test_html == mark_safe('
%s
' % (klass, label)) -@pytest.mark.freeze_time("2018-03-05 15:46:00") +@pytest.mark.freeze_time('2018-03-05 15:46:00') def test_mdr_soon_to_be_closed(): test_html = as_opening_hours_badge(MDR_GEOJSON[0]) klass, label = 'soon-to-be-closed', "Ouvert jusqu'à 16h45" assert test_html == mark_safe('
%s
' % (klass, label)) -@pytest.mark.freeze_time("2018-03-10 17:30:00") +@pytest.mark.freeze_time('2018-03-10 17:30:00') def test_mdr_just_closed(): test_html = as_opening_hours_badge(MDR_GEOJSON[0]) - klass, label = 'closed', "Réouvre lundi à 8h30" + klass, label = 'closed', 'Réouvre lundi à 8h30' assert test_html == mark_safe('
%s
' % (klass, label)) -@pytest.mark.freeze_time("2018-01-01 14:59:00") +@pytest.mark.freeze_time('2018-01-01 14:59:00') def test_mairie_holiday(): # Ecully, using datetimes test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['identifiant'] == 'S1361'][0] - klass, label = 'closed', "Réouvre demain à 8h30" + klass, label = 'closed', 'Réouvre demain à 8h30' assert test_html == mark_safe('
%s
' % (klass, label)) # Feyzin, using dates test_html = [as_opening_hours_badge(x) for x in GEOJSON if x['properties']['identifiant'] == 'S1365'][0] - klass, label = 'closed', "Réouvre demain à 8h30" + klass, label = 'closed', 'Réouvre demain à 8h30' assert test_html == mark_safe('
%s
' % (klass, label)) -@pytest.mark.freeze_time("2018-03-05 00:30:00") +@pytest.mark.freeze_time('2018-03-05 00:30:00') @pytest.mark.parametrize( 'day, hours, badge, text', [ @@ -188,7 +188,7 @@ def test_mairie_holiday(): ('lundi_am', '00h00-00h45', 'soon-to-be-closed', "Ouvert jusqu'à 0h45"), ('dimanche_pm', '20h30-00h45', 'soon-to-be-closed', "Ouvert jusqu'à 0h45"), ('lundi_am', '00h15-24h00', 'open', "Ouvert jusqu'à minuit"), - ('lundi_am', '00h00-24h00', 'open', "Ouvert 24h/24"), + ('lundi_am', '00h00-24h00', 'open', 'Ouvert 24h/24'), ], ) def test_mdr_format(day, hours, badge, text): @@ -206,7 +206,7 @@ def test_mdr_format(day, hours, badge, text): assert html == '
%s
' % (badge, text) -@pytest.mark.freeze_time("2018-03-05 00:30:00") +@pytest.mark.freeze_time('2018-03-05 00:30:00') @pytest.mark.parametrize( 'openinghour, badge, text', [ @@ -219,7 +219,7 @@ def test_mdr_format(day, hours, badge, text): ('Mo 00:00-00:45', 'soon-to-be-closed', "Ouvert jusqu'à 0h45"), ('Su 20:30-00:45', 'soon-to-be-closed', "Ouvert jusqu'à 0h45"), ('Mo 00:15-24:00', 'open', "Ouvert jusqu'à minuit"), - ('Mo 00:00-24:00', 'open', "Ouvert 24h/24"), + ('Mo 00:00-24:00', 'open', 'Ouvert 24h/24'), ], ) def test_mairie_format_openinghours(openinghour, badge, text): @@ -237,7 +237,7 @@ def test_mairie_format_openinghours(openinghour, badge, text): assert html == '
%s
' % (badge, text) -@pytest.mark.freeze_time("2018-03-05 00:30:00") +@pytest.mark.freeze_time('2018-03-05 00:30:00') @pytest.mark.parametrize( 'day, opens, closes, badge, text', [ @@ -250,7 +250,7 @@ def test_mairie_format_openinghours(openinghour, badge, text): ('Monday', '00:00', '00:45', 'soon-to-be-closed', "Ouvert jusqu'à 0h45"), ('Sunday', '20:30', '00:45', 'soon-to-be-closed', "Ouvert jusqu'à 0h45"), ('Monday', '00:15', '24:00', 'open', "Ouvert jusqu'à minuit"), - ('Monday', '00:00', '24:00', 'open', "Ouvert 24h/24"), + ('Monday', '00:00', '24:00', 'open', 'Ouvert 24h/24'), ], ) def test_mairie_format_openinghoursspecification(day, opens, closes, badge, text): @@ -275,7 +275,7 @@ def test_mairie_format_openinghoursspecification(day, opens, closes, badge, text assert html == '
%s
' % (badge, text) -@pytest.mark.freeze_time("2018-03-09 00:30:00") +@pytest.mark.freeze_time('2018-03-09 00:30:00') def test_mairie_having_both_formats(): """openinghoursspecification take preference over openinghours""" geojson = r""" @@ -298,7 +298,7 @@ def test_mairie_having_both_formats(): assert html == '
%s
' % ('closed', 'Réouvre lundi à 9h30') -@pytest.mark.freeze_time("2021-01-21 15:37:00") +@pytest.mark.freeze_time('2021-01-21 15:37:00') def test_mairie_saint_genis_lavak(): """#50337""" geojson = json.load(open(os.path.join(BASE_DIR, 'tests/data/mairie-saint-genis-lavak.json'))) @@ -313,8 +313,8 @@ def test_mairie_saint_genis_lavak(): [ ('2017-12-01', '2018-02-01', 'closed', 'Fermé'), ('2018-01-04', '2018-01-04', 'closed', 'Réouvre demain à 8h30'), - ('2018-01-04', '2018-01-09', 'closed', "Réouvre mercredi à 8h30"), - ('2018-01-04', '2018-01-11', 'closed', "Fermé"), + ('2018-01-04', '2018-01-09', 'closed', 'Réouvre mercredi à 8h30'), + ('2018-01-04', '2018-01-11', 'closed', 'Fermé'), ('2018-01-05', '2018-01-11', 'open', "Ouvert jusqu'à 17h30"), ], ) diff --git a/tests/test_get_mairie_opening_hours.py b/tests/test_get_mairie_opening_hours.py index ea6ffc7..655ecc2 100644 --- a/tests/test_get_mairie_opening_hours.py +++ b/tests/test_get_mairie_opening_hours.py @@ -8,7 +8,7 @@ from combo_plugin_gnm.templatetags.gnm import EN_FULL_WEEKDAYS_LIST, FR_WEEKDAYS BASE_DIR = os.path.dirname(os.path.dirname(__file__)) GEOJSON = json.load(open(os.path.join(BASE_DIR, 'tests/data/mairie-geojson.json')))['features'] -TZOFFSETS = {"Europe/Paris": 3600} +TZOFFSETS = {'Europe/Paris': 3600} def test_mairie_hours_parsing(): @@ -60,7 +60,7 @@ def test_mairie_hours_special_data(): ] -@pytest.mark.freeze_time("2018-03-05 15:59:00") +@pytest.mark.freeze_time('2018-03-05 15:59:00') def test_mairie_openinghoursspecification_period_valid(): """Test valid periods of openinghoursspecification timetables""" for x in GEOJSON: @@ -76,7 +76,7 @@ def test_mairie_openinghoursspecification_period_valid(): return -@pytest.mark.freeze_time("2020-03-05 15:59:00") +@pytest.mark.freeze_time('2020-03-05 15:59:00') def test_mairie_openinghoursspecification_period_all_closed(): # display known format but no opening hours as all closed for x in GEOJSON: @@ -109,7 +109,7 @@ def test_mairie_sathonay_timetable(): def test_mairie_saint_priest(): - "S1406" + 'S1406' test_time_table = [ get_mairie_opening_hours(x) for x in GEOJSON if x['properties']['identifiant'] == 'S1406' ][0] @@ -150,7 +150,7 @@ def test_mairie_format_openinghours(): ] -@pytest.mark.freeze_time("2018-03-09 00:30:00") +@pytest.mark.freeze_time('2018-03-09 00:30:00') def test_mairie_format_openinghoursspecification(): """openinghoursspecification the default format""" geojson = r""" @@ -212,7 +212,7 @@ def test_mairie_format_openinghoursspecification(): ] -@pytest.mark.freeze_time("2018-03-09 00:30:00") +@pytest.mark.freeze_time('2018-03-09 00:30:00') def test_mairie_having_both_formats(): """openinghoursspecification take preference over openinghours""" geojson = r""" @@ -235,7 +235,7 @@ def test_mairie_having_both_formats(): assert hours[0] == ('lundi', {'am': '09h30-12h30', 'pm': None}) -@pytest.mark.freeze_time("2021-01-21 15:37:00") +@pytest.mark.freeze_time('2021-01-21 15:37:00') def test_mairie_saint_genis_lavak(): """#50337""" geojson = json.load(open(os.path.join(BASE_DIR, 'tests/data/mairie-saint-genis-lavak.json'))) @@ -250,7 +250,7 @@ def test_mairie_saint_genis_lavak(): ] -@pytest.mark.freeze_time("2018-01-01 14:59:00") +@pytest.mark.freeze_time('2018-01-01 14:59:00') def test_mairie_holiday_day(): # Ecully, using datetimes test_time_table = [