From 5c29dbfd1f882859ae5dbaf10fb6b1e41372850a Mon Sep 17 00:00:00 2001 From: Dennis Iversen Date: Thu, 23 Jan 2025 10:26:55 +0100 Subject: [PATCH] better naming for json and html routes --- stadsarkiv_client/endpoints/endpoints_records.py | 7 ++++++- stadsarkiv_client/routes.py | 3 ++- stadsarkiv_client/templates/records/record.html | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/stadsarkiv_client/endpoints/endpoints_records.py b/stadsarkiv_client/endpoints/endpoints_records.py index 331c8108..c20be964 100644 --- a/stadsarkiv_client/endpoints/endpoints_records.py +++ b/stadsarkiv_client/endpoints/endpoints_records.py @@ -133,7 +133,12 @@ async def records_get(request: Request): return templates.TemplateResponse(request, "records/record.html", context) -async def records_get_json(request: Request): +async def records_get_misc(request: Request): + """ + Miscellaneous presentations of the record data. + Mostly JSON for debugging. + Also some simple HTML rendering. + """ try: record_id = request.path_params["record_id"] diff --git a/stadsarkiv_client/routes.py b/stadsarkiv_client/routes.py index adae5e03..a5ff9a85 100644 --- a/stadsarkiv_client/routes.py +++ b/stadsarkiv_client/routes.py @@ -121,7 +121,8 @@ async def robots_txt(request: Request): Route("/auto_complete_relations", endpoint=endpoints_search.records_auto_complete_relations, name="records_auto_complete_relations"), Route("/search/json", endpoint=endpoints_search.search_get_json, name="search_get_json"), Route("/records/{record_id:str}", endpoint=endpoints_records.records_get, name="records_get"), - Route("/records/{record_id:str}/json/{type:str}", endpoint=endpoints_records.records_get_json, name="records_get_json"), + Route("/records/{record_id:str}/json/{type:str}", endpoint=endpoints_records.records_get_misc, name="records_get_json"), + Route("/records/{record_id:str}/html/{type:str}", endpoint=endpoints_records.records_get_misc, name="records_get_html"), Route("/relations", endpoint=endpoints_relations.relations_post, name="relations_post", methods=["POST"]), Route("/relations/{rel_id:str}", endpoint=endpoints_relations.relations_delete, name="relations_delete", methods=["DELETE"]), Route("/relations/{type:str}/{id:str}", endpoint=endpoints_relations.relations_get, name="relations_get"), diff --git a/stadsarkiv_client/templates/records/record.html b/stadsarkiv_client/templates/records/record.html index 2b67b554..06028875 100644 --- a/stadsarkiv_client/templates/records/record.html +++ b/stadsarkiv_client/templates/records/record.html @@ -62,7 +62,7 @@ {'label': 'JSON. Record fra API efter hooks', 'url': url_for('records_get_json', record_id=meta_data.id, type='record') | string}, {'label': 'JSON. Metadata', 'url': url_for('records_get_json', record_id=meta_data.id, type='meta_data') | string}, {'label': 'JSON. Typer og værdier', 'url': url_for('records_get_json', record_id=meta_data.id, type='record_and_types') | string}, - {'label': 'HTML. Enkel visning', 'url': url_for('records_get_json', record_id=meta_data.id, type='record_and_types_parsed') | string} + {'label': 'HTML. Enkel visning', 'url': url_for('records_get_html', record_id=meta_data.id, type='record_and_types_parsed') | string} ] %}