TEMPLATE_STRING_IF_INVALID settable per template rendering
|Reported by:||vanschelven||Owned by:||nobody|
|Cc:||Triage Stage:||Design decision needed|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
It would be nice if TEMPLATE_STRING_IF_INVALID is settable per template rendering.
I have created a version of this here:
In this particular prototype the TEMPLATE_STRING_IF_INVALID is looked up in the context, as well as in the settings (in that order).
A greater reworking of the templating system would allow for
template.render(......, string_if_invalid="YOUR_STRING %s")
In some cases you want to be absolutely sure that whatever you tell the template to render either shows up, or generates an error.
This can also be used in combination with Exceptions on rendering by using a tool like this:
In some cases (notably the admin) it is unfortunately currently impossible to use the TEMPLATE_STRING_IF_INVALID at all.
Having a per-template approach allows for more flexibility.