Thanks Anand, your idea is great. I'll give it a try (in my
next multi-lingual project :)
Saturday, August 4, 2007, 8:49:45 PM, you wrote:
>> Found the answer myself (hopefully the right answer):
>> I need to void the cache: render.cache = {}
> you can completely disable caching by doing this.
> render = web.template.render('template/', cache=False)
> But i think the correct solution to your problem is having many
> templates/lang directories and use the appropriate one based on the
> language argument in the URL.
> Probably, you can store language in web.ctx.lang and write a wrapper
> over render to use that automatically.
> class LangRender:
> def __init__(self, render):
> self.render = render
> def __getattr__(self, key):
> return getattr(getattr(self.render, web.ctx.lang), key)
> render = LangRender(web.template.render('templates/'))
> class Hello:
> def GET(self, lang):
> web.ctx.lang = lang
> print render.hello()
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" 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/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---