On Thu, Mar 6, 2008 at 4:02 PM, Jonathan Vanasco <[EMAIL PROTECTED]> wrote:
>
>  i.
>  I'd like to make session information available to templates.  i can't
>  figure out any way other than: "c.session = session"

In Mako you can use a Python escape to import it:

<%! from pylons import session %>

>  ii.
>  Is there a way to put a hook into render() so i can call some specific
>  variable injections into c on each request?  or is there a different
>  idiomatic way to achieve this effect?

You can put the assignments in the base controller's .__call__ method
(in myapp/lib/base.py), or in any controller's .__before__.  I use
that to initialize c.title and c.crumbs, which my site template
depends on.  I initialize them to blank, then an action can update
them if it wants a more specific title.

-- 
Mike Orr <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
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