macro pagetemplates are not automatically reloaded when changed
Bug #162261 reported by
Martijn Faassen
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
grok |
Fix Released
|
High
|
Martijn Faassen | ||
1.0 |
Fix Released
|
High
|
Martijn Faassen |
Bug Description
If a page template is a macro and you change the macro, the changed macro is not automatically reloaded. I think it did work before, but it fails in
Grok 0.11.
Changed in grok: | |
assignee: | nobody → regebro-gmail |
importance: | Undecided → High |
milestone: | none → 0.11 |
status: | New → Confirmed |
Changed in grok: | |
milestone: | 0.11 → 1.0 |
Changed in grok: | |
assignee: | regebro-gmail → faassen |
To post a comment you must log in.
Found the problem: grokcore/ view/components .py, around line 213. In the PageTemplate class::
def _initFactory(self, factory):
factory. macros = self._template. macros
That ought to be something like::
def _initFactory(self, factory): _template. macros
factory. macros = property( _get_macros)
"""For zope page templates only: add macros property to view class.
"""
def _get_macros(self):
return self.template.
Reason: self_template. macros is a property in zope pagetemplate that does a _cook_check() and returns self._v_macros. With the existing code, the macros property of zope pagetemplate is called just once and subsequent cook checks don't happen.
With the new code, the original macros() call, including cook check, is happening all the time.
The special macros attribute setting by _initFactory is, according to jwkolman, especially for zope page templates. So this changes seems warranted.
I'll mail this to the grok list, too. And I'll prepare a patch with test.