I have a jinja template with the usual boilerplate links, one of them being the "sign out" link. The URL of this link has to be generated using Users.create_logout_url() before rendering a page.
I would like to avoid having to generate this URL and add it to my render_response for every single get/post handler. I've looked into alternatives but have not found a functional way to go about this.
BaseRequestHandler
This seems like the cleanest approach, but I'm unsure how to go about it. Would it be a case of
self.vars['logout_link'] = users.create_logout_url(self.request.path))
..and then, in all standard response handlers:
return render_response('template.html', **vars)
?
Decorators
This seems like another option, although seems slightly messy. I suppose it would work in the same way (assigning the logout link to a local variable in a wrapper function).
Context Processing?
I'm using tipfy/jinja, which doesn't seem to support this as far as I can tell.
Any advice which path I should investigate further?
Thanks