refactor notifications to MVC: extract templates, context, and renderer

- Move all email layout to Jinja2 templates (4 files: admin_new,
  admin_update, parent_confirmation html+txt)
- Extract pure helper/context-builder functions to context.py
  (format_types, calculate_age, format_dob, calculate_monthly_fee,
  format_days, build_admin_new_context, build_admin_update_context,
  build_parent_context)
- Move i18n label strings out of Python into YAML locale files
  (i18n/de.yaml, i18n/en.yaml) — admin-editable without code changes
- Add renderer.py as thin Jinja2 wrapper (render_template)
- Reduce notifier.py to routing + SMTP dispatch only
- Update tests to call context functions directly and render
  templates via renderer instead of calling private builder methods
- Add jinja2 and pyyaml as explicit dependencies in pyproject.toml

https://claude.ai/code/session_01LjjK7RjKVnC8bETtccfgna
This commit is contained in:
Claude
2026-02-23 10:05:03 +00:00
parent b2e04fa07b
commit 54d88d1d64
11 changed files with 699 additions and 596 deletions
+57
View File
@@ -0,0 +1,57 @@
subject: "Anmeldebestätigung Spielgruppe Pumuckl"
greeting: "Guten Tag {name}"
intro: >-
Deine Anmeldung für die Spielgruppe Pumuckl ist bei uns eingegangen.
Hier ist eine Zusammenfassung:
child_section: "Angaben zum Kind"
child_name: "Name"
child_dob: "Geburtsdatum"
child_needs: "Besondere Bedürfnisse"
booking_section: "Spielgruppen-Buchung"
booking_type: "Art"
booking_days: "Tage"
fees_section: "Kosten"
monthly_fee: "Monatlicher Beitrag"
reg_fee: "Anmeldegebühr (einmalig, erstes Jahr)"
reg_fee_amount: "CHF 80.00"
deposit: "Reinigungsdepot Innen (rückerstattbar)"
deposit_amount: "CHF 50.00"
parent_section: "Deine Kontaktdaten"
parent_name: "Name"
parent_address: "Adresse"
parent_phone: "Telefon"
parent_email: "E-Mail"
emergency_section: "Notfallkontakt"
emergency_name: "Name"
emergency_phone: "Telefon"
payment_section: "Zahlungsinformationen"
payment_intro: >-
Bitte überweise die Anmeldegebühr von <strong>CHF&nbsp;80.00</strong> auf folgendes Konto.
Du kannst den QR-Code mit deiner Banking-App scannen:
payment_intro_text: "Bitte überweise die Anmeldegebühr von CHF 80.00 auf folgendes Konto:"
iban_label: "IBAN"
payee_label: "Empfänger"
amount_label: "Betrag"
closing: |
Bei Fragen stehen wir dir gerne zur Verfügung. Wir freuen uns auf dein Kind!
Herzliche Grüsse
Spielgruppe Pumuckl
none: "Keine"
days:
monday: "Montag"
wednesday: "Mittwoch"
thursday: "Donnerstag"
types:
indoor: "Innenspielgruppe"
outdoor: "Waldspielgruppe"