What is the equivalent of template context in Pyramid?
Does the IBeforeRender event in pyramid have anything to with this? I’ve gone through the official documentation but diffcult to understand what the IBeforeRender event is exactly.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Pyramid already provides a
tmpl_contexton its Request object, so pretty simply you just have to subscribe aBeforeRenderevent to add it to the renderer globals:From now on in your code when you receive a request, you can set parameters on it:
And subsequently your template may reference the
namevariable: