> 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 [email protected]. To view this discussion visit https://groups.google.com/d/msgid/pylons-discuss/BF99B5E2-5F30-4410-88CC-7F16EECA375E%40florian-schulze.net.
