I’m using bottle for a toy application. It’s my first time getting with the framework.
I’m curious about how to access some keys I’ve added to the request object from inside a template.
Doing a naive {{request.key}} raises an exception saying that requestis not defined, so I’m gessing that the object is not passed to every template context..
It is information that I’ll be accessing in every view so I think this is the right approach, but I’m not nailing bottle’s way of doing it.
Any idea?
You just need to add the request to the template render function
The render template function passes keyword arguments as local variables inside the template. Nothing is passed to the template context for you.