mirror of
https://github.com/hrfee/jfa-go.git
synced 2026-01-18 16:47:42 +01:00
messages: custom content described in customcontent.go, message tests
customcontent.go constains a structure with all the custom content, methods for getting display names, subjects, etc., and a list of variables, conditionals, and placeholder values. Tests for constructX methods included in email_test.go, and all jfa-go tests can be run with make INTERNAL=off test.
This commit is contained in:
16
scripts/scrape-custom-content-schema.py
Normal file
16
scripts/scrape-custom-content-schema.py
Normal file
@@ -0,0 +1,16 @@
|
||||
# Quick script to scrape custom content names, variables and conditionals. The decision to generate vars and conds dynamically from the included plaintext emails, then bodge extra variables on top was stupid, and is only done -once- before getting stored in the DB indefinitely, meaning new variables can't easily be added. Output of this will be coalesced into a predefined list included with the software.
|
||||
import requests, json
|
||||
|
||||
content = requests.get("http://localhost:8056/config/emails?lang=en-gb&filter=user").json()
|
||||
|
||||
out = {}
|
||||
|
||||
for key in content:
|
||||
resp = requests.get("http://localhost:8056/config/emails/"+key)
|
||||
out[key] = resp.json()
|
||||
del out[key]["html"]
|
||||
del out[key]["plaintext"]
|
||||
del out[key]["content"]
|
||||
|
||||
print(json.dumps(out, indent=4))
|
||||
|
||||
Reference in New Issue
Block a user