Hi NiL,
Sorry for my delay...
I'm afraid that I didn't make myself understand. Let me explain it
again.
I've defined several Jinja2 templates that I'm using for other things
apart from controllers. I mean, i don't use those templates to
generate web pages (through controllers), but I use those templates to
generate HTML e-mails or Excel reports, etc. As I'm using Jinja2 to
generate web pages, I want to make use of the same mechanism for the
"no-generate-web-pages" templates.
A bit later after the first post I discovered this, but i don't know
if it's a "correct" way, or there's another better/more common way:
# controllers/root.py
from pylons.templating import render_jinja2
...
class RootController(BaseController):
@expose()
def a_send_mail_web_service(self, name='', msg=''):
mail_text = render_jinja2('other_templates/message.txt',
extra_vars=dict(name=name, message=msg))
send_email_to_somewhere(mail_text)
return ???
then inside the template:
# other_templates/message.txt
Hi {{name}},
{{message}}
Best regards
Thanks,
León
On Apr 4, 11:13 am, NiL <[email protected]> wrote:
> > base_config.renderers.append('mako')
>
> of course should be
>
> base_config.renderers.append('jinja2')
>
> On Apr 4, 9:28 am, NiL <[email protected]> wrote:
>
>
>
>
>
>
>
> > What I would do is, in config/app_cfg.py
>
> > base_config.renderers.append('mako')
>
> > then in a controller
>
> > @expose("jinja2:project.templates.some_template",
> > content_type='text/html')
> > def index(self, **kw):
>
> > HTH
>
> > NiL
--
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears?hl=en.