fix: Correctly convert single paragraph in FastAPI
This commit is contained in:
@@ -160,9 +160,14 @@ def paragraph(
|
|||||||
"""
|
"""
|
||||||
xml = _get_fmx4_data(celex_id, language)
|
xml = _get_fmx4_data(celex_id, language)
|
||||||
parag = extract_paragraph(xml, article_id=article_id, paragraph_id=parag_id)
|
parag = extract_paragraph(xml, article_id=article_id, paragraph_id=parag_id)
|
||||||
|
if parag is None:
|
||||||
|
return Response(
|
||||||
|
"Paragraph not found",
|
||||||
|
status_code=404,
|
||||||
|
)
|
||||||
|
|
||||||
return Response(
|
return Response(
|
||||||
FormexArticleConverter(language=language).convert_article(parag),
|
FormexArticleConverter(language=language)._convert_parag(parag),
|
||||||
media_type="text/html",
|
media_type="text/html",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user