You can create an 'h' helper object as described here--> http://docs.pylonsproject.org/projects/pyramid_cookbook/en/latest/templates/templates.html#using-a-before-render-event-to-expose-an-h-helper-object
or just have a subscribers.py file with: @subscriber(BeforeRender) def template_globals(event): request = event['request'] ## this is how you access the request object in this function from datetime import datetime event.update({'someglobalvar': 'this is my global value', 'thedate': datetime.now}) return ##no need to return anything Then you can just do ${thedate()} in any of your templates. -Raj On Wednesday, May 9, 2012 12:27:14 AM UTC-4, Theron Luhn wrote: > > I can pass variables into my template by returning them in a dictionary > from the view controller. However, if I try to access a variable from the > template that I didn't pass, I'll get an error. Is it possible to have a > default value so I don't get an error? Maybe with BeforeRender or something? > > - Theron > -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To view this discussion on the web visit https://groups.google.com/d/msg/pylons-discuss/-/nGUrsJRxxX0J. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.