Delivering HTML snippets over HTTP as browser page

This browser page

 <browser:page 
    for="..." 
    class="..."
    permission="..."
   name="as-tile"
   template="tile.pt"/>

tile.pt:

<div class="tile">....</div>

is supposed to return some HTML fragment.

Plone/Zope however inserts a HTML around a fragment and Plone injects script tag for protect.js.
Is there a way to avoid this? I want the pure HTML fragment.

-aj

Not related to the question, but should you be using 'tile' ?

<plone:tile
    name="…"
    title="…"
    for="…"
    schema=".tiles.IMyTile"
    class=".tiles.MultiTile"
    template="templates/my-tile.pt"

Ugh, it looks like there's no good way to prevent this for particular text/html responses. auto.py in plone.protect is the place to add a way.

Again, completely unrelated.

-aj

True.

The workaround is to write a helper browser view that traverses into the original view and returns the HTML snippet directly.

-aj

I think you can add a ITransform for (IMyTile, *) and skip the transform all together.

Something like https://github.com/plone/plone.tiles/commit/fba7783024d6aa50dae5945b59d400716968432a

Not beautiful, but should work.

Thanks but this is completely over the top :slight_smile: