ErrorsBuilt-in services · rule
email.template_not_allowed
An email template calls a function, does arithmetic or builds a value, when it may only read its fields, translate and format.
Area 16, Built-in services; not declinable; the next step is usually the agent's.
Why Jadpo refuses it
A template reads its email's fields, calls translations and
text.format, compares values in {{ if }} and walks lists with
{{ for }}. Anything else an email says is worked out in the code that
emits it, and given to the email as a field. That keeps the email's
words in one place, where a reviewer reads them, rather than spread
between the code and its templates.
What it looks like
The welcome email's heading changes its field's value with a call.
domains/accounts/emails/welcome_email.html:
<h1>WELCOME, {{ text.upper(name) }}</h1>error A template only reads its fields, translates and formats
--> domains/accounts/emails/welcome_email.html:1:17
|1 | <h1>WELCOME, {{ text.upper(name) }}</h1> | ^^^^^^^^^^^^^^^^ a call
- reason
- Templates are strict: they read their email's fields, call translations and
text.format, compare values in{{ if }}and walk lists with{{ for }}, so what an email says is decided where it is emitted, and a reviewer reads its words in one place. - next
- Call only
translations.<domain>.<message>(...)andtext.format(...); work anything else out where the email is emitted, and give it to the email as a field (agent) - rule
- email.
template_ not_ allowed - help
- https://jadpo.
dev/docs/errors/email. template_ not_ allowed
(agent) at the end of the next: line means your coding agent can make
the fix itself.
How to fix it
If the field can be written as it is, write it out without the call.
In domains/accounts/emails/welcome_email.html:
<h1>Welcome, {{ name }}</h1>The heading writes the name as the email was given it.
If the email needs a value worked out, give the email a field for
it, and work the value out in the code that emits the email. In
domains/accounts/emails/welcome_email.jadpo:
heading_name: TextThen the template writes the field out. In
domains/accounts/emails/welcome_email.html:
<h1>WELCOME, {{ heading_name }}</h1>Every place that emits WelcomeEmail now gives heading_name, so the
value is worked out in code a reviewer reads, and the template only
writes it.
Related
Markdown for agents: /docs/errors/email.template_not_allowed.md.Built from Jadpo main at aee2e8f.