Commit 9f18a95b authored by Hanno Schlichting's avatar Hanno Schlichting

simplify getting the root

parent f78e908c
...@@ -18,6 +18,7 @@ $Id$ ...@@ -18,6 +18,7 @@ $Id$
import zope.app.pagetemplate import zope.app.pagetemplate
from Acquisition import aq_base from Acquisition import aq_base
from Acquisition import aq_get
from Acquisition import aq_parent from Acquisition import aq_parent
from AccessControl import getSecurityManager from AccessControl import getSecurityManager
from Products.PageTemplates.Expressions import SecureModuleImporter from Products.PageTemplates.Expressions import SecureModuleImporter
...@@ -39,11 +40,9 @@ class ViewPageTemplateFile(zope.app.pagetemplate.ViewPageTemplateFile): ...@@ -39,11 +40,9 @@ class ViewPageTemplateFile(zope.app.pagetemplate.ViewPageTemplateFile):
# get the root # get the root
obj = context['context'] obj = context['context']
root = None root = None
while (getattr(aq_base(obj), 'getPhysicalRoot', None) is None meth = aq_get(obj, 'getPhysicalRoot', None)
and aq_parent(obj) is not None): if meth is not None:
obj = aq_parent(obj) root = meth()
if getattr(obj, 'getPhysicalRoot', None) is not None:
root = obj.getPhysicalRoot()
context.update(here=context['context'], context.update(here=context['context'],
# philiKON thinks container should be the view, # philiKON thinks container should be the view,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment