Re: Implementing custom Mako template lookup

2011-11-01 Thread Andrew Trachenko
Thank you, Michael! It worked.

On 1 ноя, 20:34, Michael Merickel  wrote:
> You can add or override a renderer via the config.add_renderer() directive
> here:http://docs.pylonsproject.org/projects/pyramid/1.2/narr/renderers.htm...
>
> Renderers have access to the request object so accessing the current
> language shouldn't be an issue.
>
> --
>
> Michael

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



Re: Implementing custom Mako template lookup

2011-11-01 Thread Michael Merickel
You can add or override a renderer via the config.add_renderer() directive
here:
http://docs.pylonsproject.org/projects/pyramid/1.2/narr/renderers.html#adding-and-changing-renderers

Renderers have access to the request object so accessing the current
language shouldn't be an issue.

-- 

Michael

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



Implementing custom Mako template lookup

2011-11-01 Thread Andrew Trachenko
Hello,

I want to implement the following feature. When I specify the
@action(..., renderer='template.mako')
view decorator (in terms of pyramid_handlers), I'd like to check for
localized versions of the template file (e.g. "template.en.mako" in my
case), and fall back on the specified file.

I think I need to subclass the
pyramid.mako_templating.MakoLookupTemplateRenderer class, overwrite
the implementation() method and tell Pyramid to use my class. How can
I archive this?

I also wonder if it'll be possible to have access to the the current
language from there.

Best wishes,
Andrew

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