Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inheritance chain argument (default values) passing problem #306

Open
lv-gh opened this issue Sep 27, 2019 · 1 comment
Open

inheritance chain argument (default values) passing problem #306

lv-gh opened this issue Sep 27, 2019 · 1 comment

Comments

@lv-gh
Copy link

lv-gh commented Sep 27, 2019

Maybe it's not a bug at all, but i find argument passing/inheriting in the inheritance chain to be obscure.
Example:

## base.mako
<%page args="x='title',y='description'" />
<base>
	arg 'x': ${x}, arg 'y': ${y}
	<%block name="foo" />
</base>

## inheriting.mako
<%inherit file="base.mako" />
<%block name="foo">
	<title>${x}</title>
	<desc>${y}</desc>
</%block>

And two cases (first works, but second don't):

mylookup.get_template('inheriting.mako').render(x='title', y='description'))
mylookup.get_template('inheriting.mako').render())

Though args with default values are set in <%page> and are valid/visible in the inheritted template (base.mako; note inheriting (inheriting.mako<-base.mako) involved) , but not in the inheriting template and it's named blocks.
I know that i could pass args to named blocks via args param explicitly, but shouldn't <%page args (default values) also be inherited? (render() supplied args are visible in all templates/contexts)
In other wors: is there any posibility to set all arg default values in one place?

@zzzeek
Copy link
Member

zzzeek commented Sep 28, 2019

I know that i could pass args to named blocks via args param explicitly, but shouldn't <%page args (default values) also be inherited? (render() supplied args are visible in all templates/contexts)

im not really sure, but I can say those mechanics are baked in for good for the foreseeable future. they are not easy to change and Mako is not seeing active development right now.

@bourke bourke added this to Icebox in Mako prioritization Nov 17, 2021
@bourke bourke moved this from Icebox to Deep Freeze in Mako prioritization Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants