On Jun 24, 9:25 am, Jonathan Vanasco <[EMAIL PROTECTED]> wrote:
> I'm trying to make two other objects available to all templates.
>
> I'm wondering what the best practice would be.
>
> Looking at pylons.templating, I'm honestly a bit confused about what
> is going on.
>
> ( and if you're wondering: object1 is a version of pylons.c that is
> for the underlying framework we built on pylons ; object2 is a second
> version that will return the value in pylons if it exists, else
> default to the object1 value )
I'd just wrap the existing render_mako with a function that will
update the extra_vars arg with your extra stuff. Stick that in a file
in your lib (myproject.lib.templating, for example), and then change
every controller to import that render function instead of the one
from pylons.templating.
something like:
from pylons.templating import render_mako
def render(template_name, extra_vars=None, cache_key=None,
cache_type=None, cache_expire=None):
extra_vars.update(dict(object1=something, object2=something))
return render_mako(template_name, extra_vars=extra_vars,
cache_key=cache_key,
cache_type=cache_type, cache_expire=cache_expire)
HTH...
--Isaac
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---