Refactor: extract vCard generator to utils; make BASE_DIR configurable for tests; add unit and integration tests for vcard export; update app to use utils

This commit is contained in:
Albert
2025-11-09 19:56:46 +01:00
parent 998574f26a
commit 62613a2f39
2 changed files with 9 additions and 5 deletions

5
app.py
View File

@@ -97,8 +97,9 @@ def index():
# vCard 4.0 erzeugen und speichern
try:
# generate vcard using helper
generate_vcard(adresse, BASE_DIR)
# determine base dir: prefer app.config, then app attribute, then module BASE_DIR
base_dir = app.config.get('BASE_DIR') if app.config.get('BASE_DIR') else getattr(app, 'BASE_DIR', BASE_DIR)
generate_vcard(adresse, base_dir)
except Exception:
# nicht kritisch: bei Fehlern nicht die ganze Anfrage abbrechen
pass