I actually just now found the BeforeRender event, which seems to be what we 
need :)

Thanks,
Milan

On Friday, June 6, 2025 at 8:39:55 AM UTC+2 Florian Schulze wrote:

> > 2. We have some variables that were set in Pylons as globals and are used
> > almost in all templates.
> > What is the best way to add these variables to all views or a subset of
> > views without explicitly adding them to every view ? I was looking at
> > tweens or just creating a base class from which the view classes would
> > descend and would inject the variables in returned dictionary.
> > Maybe there is a better way?
>
> You can inject variables into the renderer:
>
> https://docs.pylonsproject.org/projects/pyramid/en/2.0-branch/narr/hooks.html#using-the-before-render-event
>
> Or add a method/property to requests:
>
> https://docs.pylonsproject.org/projects/pyramid/en/2.0-branch/api/config.html#pyramid.config.Configurator.add_request_method
>
> There might be other more appropriate methods using other events or hooks 
> depending on your use cases.
>
> Regards,
> Florian
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-discuss+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/pylons-discuss/78ee24a9-b5b4-48d5-9bb3-58bc872ed022n%40googlegroups.com.

Reply via email to