On 02/15/2017 08:07 AM, Дмитрий Архипов wrote:
> Suppose I have a def block named "foo" in a template.
> I use that template as a namepace and import the function from it:
>
> <%namespace file="lib.mako" import="foo"/>
>
> How do I use the imported function with embedded content?
>
> This doesn't work:
>
> <%self.foo>
> text...
> </%self.foo>
I don't think there's an "implicit" namespace available right now so
you'd need to give your <%namespace> a local name and use that the way
it is in the docs:
<%namespace file="lib.mako" name="mylib">
<%mylib.foo>
</%mylib.foo>
otherwise you can use the <%call> tag directly which is kind of old school
<%call expr="foo()">
text
</%call>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Mako Templates for Python" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to mako-discuss...@googlegroups.com
> <mailto:mako-discuss+unsub...@googlegroups.com>.