New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chameleon short-hand text insertion ${structure: ...}
throws exception
#1077
Comments
Peter Mathis wrote at 2022-12-7 06:46 -0800:
...
Instead of usually place unescaped HTML inside templates like
<span tal:replace="structure view/formatted_event_date" />
```
I tried the Chameleon"short-hand text insertion" for unescaped HTML like documented here https://chameleon.readthedocs.io/en/latest/
<p>${structure:view/some_formatted_html}</p>
```
### What I expect to happen:
The formatted HTML string returned from the view should be placed unescaped inside the template.
By default, `Zope`'s `PageTemplate`s use `zope.tales` not `chameleon.tales`
as TALES expression engine.
`zope.tales` does not know about the "new types"
of `chameleon.tales` (described by
"https://chameleon.readthedocs.io/en/latest/reference.html#new-features"),
among them the `structure:` type.
You can define templates using `chamelon.tales` by overriding their
`pt_getEngine` to return a TALES engine defined in
`Products.PageTemplates.expression`.
Note that templates using different TALES engines are not fully compatible:
You cannot use a macro defined by a template with a different
TALES engine.
If those "new types" are really important, they might get
supported by `zope.tales`.
|
Moved the issue because it is effectively a feature request for |
Is there really a |
Sorry @dataflake I have been wrong:
If this should be implemented, the Zope/chameleon integration point (i.e. |
@icemac It is, see e.g. "https://chameleon.readthedocs.io/en/latest/reference.html#types". The list of "types" contains further elements currently not supported by the |
PROBLEM REPORT
What I did:
Instead of usually place unescaped HTML inside templates like
I tried the Chameleon"short-hand text insertion" for unescaped HTML like documented here https://chameleon.readthedocs.io/en/latest/
What I expect to happen:
The formatted HTML string returned from the view should be placed unescaped inside the template.
What actually happened:
A traceback:
What version of Python and Zope/Addons I am using:
Python: 3.10.7
Zope: 5.7
Plone: 6.0.0rc2
MacOS: Ventura 13.0.1
The text was updated successfully, but these errors were encountered: