You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and then change foo.pt, the renderer renders the entire foo.pt template on subsequent requests.
As far as I can tell this only applies to when pyramid.reload_templates is True.
Update:
So I've found the cause of this, but not any kind of reasonable solution. It might involve a fix in chameleon as well. The offending code is here in chameleon_zpt.py
@reify
def template(self):
tf = PageTemplateFile(
self.path,
auto_reload=self.lookup.auto_reload,
debug=self.lookup.debug,
translate=self.lookup.translate
)
if self.macro:
# render only the portion of the template included in a
# define-macro named the value of self.macro
macro_renderer = tf.macros[self.macro].include
tf._render = macro_renderer
return tf
This code is reified and returns the same PageTemplateFile object every time. But to get the macro rendering, pyramid changes the tf._render object after creating the object. But when chameleon goes to reload the template when it's changed (since it's chameleon, not pyramid doing that) it blows away the change to tf._render.
The "solution" that I did was change @reify to @Property. But that causes the template to be reloaded every single time it's accessed, not just when it's changed.
The text was updated successfully, but these errors were encountered:
If you have a renderer as such:
and then change foo.pt, the renderer renders the entire foo.pt template on subsequent requests.
As far as I can tell this only applies to when pyramid.reload_templates is True.
Update:
So I've found the cause of this, but not any kind of reasonable solution. It might involve a fix in chameleon as well. The offending code is here in chameleon_zpt.py
This code is reified and returns the same PageTemplateFile object every time. But to get the macro rendering, pyramid changes the tf._render object after creating the object. But when chameleon goes to reload the template when it's changed (since it's chameleon, not pyramid doing that) it blows away the change to tf._render.
The "solution" that I did was change @reify to @Property. But that causes the template to be reloaded every single time it's accessed, not just when it's changed.
The text was updated successfully, but these errors were encountered: