Here's the syntax that works for me:

<%inherit file="${context.get('base_file')}"/>

And in the controller you'd have something like this:

c.base_file = '/base/index.html'

Even though the variable is named c.<variable name> in the controller, when
you use context.get() you omit the "c."



On Wed, Aug 11, 2010 at 7:50 PM, Chi <[email protected]> wrote:

> Instead of static inheriting the files, like this:
>
> <%inherit file="base.mako"/>
>
> I want to set the file names dynamically in the controller with the
> context variable so that I can do this:
>
> <%inherit file="${c.base_file}"/>
>
> I tired but I got the "global name 'c' not defined" error.
> Than I tried:
>
> <%inherit file="${context.get('c.base_file')}"/>
>
> But than c.base_file is evaluated to 'None' even though I have
> assigned value to it in the controller.
>
> Also, I tried to do:
> <%namespace file="${c.function_file}" import="a_function"/>
>
> I got: TemplateLookupException: Cant locate template for uri '/page/$
> {c.function_file}'
> so the expression inside ${} is not even evaluated...
>
>
> Is it possible to use dynamic file names for mako funcions 'inherit'
> and 'namespace' etc??
>
> Thanks a lot.
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<pylons-discuss%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/pylons-discuss?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to