Frage

I have a mako filter that strips html tags. It works fine in other cases.

I have a def that looks something like:

<%def name='striptags()'>
    ${ caller.body() | strip_tags }
</%def>

This for some reason doesn't work. It seems to me that mako filters don't work when using caller.body(). Whenever I check the value of caller.body() using ipdb it is always u'', but when I see the rendered version in browser the content actually exists.

So, what is happening, and is it possible to apply a mako filter to caller.body()?

War es hilfreich?

Lösung

Have you tried

body = capture(self.body)

..and passing that to your strip_tags function? You said it doesn't strip tags, but that isn't a built in function -- maybe the problem is with the function and not the content.body() portion?

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top