Inappropriate context variable in FSPageTemplates within DirectoryViewSurrogates
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zope CMF buildout |
Confirmed
|
Low
|
Unassigned |
Bug Description
The problem is hit with FSPageTemplates that live within a DirectoryViewSu
My investigations, greatly helped by Hanno Schlichting on the plone-dev list, have led me to think that the problem lies in the pt_getContext method of Products.
from Products.
from Acquisition import aq_inner, aq_chain, aq_parent, aq_base
...
class FSPageTemplate:
...
zpt_
def pt_getContext(self, *args, **kwargs):
c = self.zpt_
if IDirectoryView.
context = c['context']
for obj in aq_chain(context):
if not IDirectoryView.
return c
-------
I am finding this with both:
python2.4 + Zope-2.10 + CMF-2.1
python-2.6 + Zope-2.12 + CMF-2.2
Changed in zope-cmf: | |
importance: | Undecided → Low |
status: | New → Confirmed |
I am adding a patch (with a test) that addresses the above issue. The patch also needs a new file in the tests directory of CMFCore, which I also attach (testNestedPT.pt), that would live in
Products. CMFCore/ Products/ CMFCore/ tests/fake_ skins/fake_ skin/test_ directory/ testNestedPT. pt
Is this the right way to add a file?
The patch differs from the above code in that I am not including the line
First, that does not change the c['container'], it remains the same as before. Second, I do not fully understand the semantic relationship between context and container, my first guess was that container was the context. aq_inner. aq_parent but that does not seem to be always (generally?) the case. And third, my use case, which is browser components that get the context from the template, does not involve the container variable at all.
So, untill further notice, I will leave it at this.