macro pagetemplates are not automatically reloaded when changed

Bug #162261 reported by Martijn Faassen on 2007-11-12
Affects Status Importance Assigned to Milestone
Martijn Faassen
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
todd (todd-infrae) on 2008-12-10
Changed in grok:
milestone: 0.11 → 1.0
Changed in grok:
assignee: regebro-gmail → faassen
Reinout van Rees (reinout) wrote :

Found the problem: grokcore/view/, 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):
        """For zope page templates only: add macros property to view class.
        def _get_macros(self):
            return self.template._template.macros
        factory.macros = property(_get_macros)

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.

Reinout van Rees (reinout) wrote :

Fixed (including test) in r99003.

Reinout van Rees (reinout) wrote :

Fix committed in r99003

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers