Update: @jaroel was right, it happens via lxml. But in a different spot.
Details: In ZPublisher.Publish.publish(), there’s a call to
notify(PubBeforeCommit(request)), which leads to
plone/transformchain/zpublisher.py(86)applyTransformOnSuccess(). One of the handlers that act upon that event is
So in the end, we land here:
Up until here, the result contains the href with the curly brackets intact. But when the
html.tostring serializer gets applied, the curly brackets get replaced in the
href when result is rendered.
The fact that I even land in this part of the code (versus stock Plone 5.1), is because the handler before that, “plone.app.theming.transform” does nothing. Therefore,
result is still in the original state that gets passed in to plone.transformchain.transformer, that means a list of strings.
In stock Plone 5.1, “plone.app.theming.transform” does indeed return output, so by the time the transformer is called in plone.protect,
result is an instance of XMLSerializer, and the lxml transform (html.tostring) never happens, because of
So finally, I think I have an idea what to do in my custom site to circumvent that problem.
And of course this leads me back to Roel’s suggestion about
which in my case is not used, because the theme itself is not enabled…