Log message for revision 78427:
  Support a bunch of top-level TALES variables
  

Changed:
  U   
Zope/branches/philikon-aq/lib/python/Products/Five/browser/pagetemplatefile.py

-=-
Modified: 
Zope/branches/philikon-aq/lib/python/Products/Five/browser/pagetemplatefile.py
===================================================================
--- 
Zope/branches/philikon-aq/lib/python/Products/Five/browser/pagetemplatefile.py  
    2007-07-28 12:15:08 UTC (rev 78426)
+++ 
Zope/branches/philikon-aq/lib/python/Products/Five/browser/pagetemplatefile.py  
    2007-07-28 14:55:04 UTC (rev 78427)
@@ -16,6 +16,9 @@
 $Id$
 """
 import zope.app.pagetemplate
+
+from Acquisition import aq_parent
+from AccessControl import getSecurityManager
 from Products.PageTemplates.Expressions import SecureModuleImporter
 from Products.PageTemplates.Expressions import createTrustedZopeEngine
 
@@ -31,7 +34,25 @@
     def pt_getContext(self, instance, request, **kw):
         context = super(ViewPageTemplateFile, self).pt_getContext(
             instance, request, **kw)
-        context['modules'] = SecureModuleImporter
+
+        # get the root
+        obj = context['context']
+        root = None
+        while (getattr(obj, 'getPhysicalRoot', None) is None
+               and aq_parent(obj) is not None):
+            obj = aq_parent(obj)
+        if getattr(obj, 'getPhysicalRoot', None) is not None:
+            root = obj.getPhysicalRoot()
+
+        context.update(here=context['context'],
+                       # philiKON thinks container should be the view,
+                       # but BBB is more important than aesthetics.
+                       container=context['context'],
+                       root=root,
+                       modules=SecureModuleImporter,
+                       traverse_subpath=[],  # BBB, never really worked
+                       user = getSecurityManager().getUser()
+                       )
         return context
 
 # BBB

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to