[Checkins] SVN: five.pt/trunk/src/five/pt/pagetemplate.py Update	the code to find the root to be compatible with Zope 2.12.	Removed optimization that shouldn't be done on this level.
    Hanno Schlichting 
    plone at hannosch.info
       
    Sat Nov 15 09:00:58 EST 2008
    
    
  
Log message for revision 92966:
  Update the code to find the root to be compatible with Zope 2.12. Removed optimization that shouldn't be done on this level.
  
Changed:
  U   five.pt/trunk/src/five/pt/pagetemplate.py
-=-
Modified: five.pt/trunk/src/five/pt/pagetemplate.py
===================================================================
--- five.pt/trunk/src/five/pt/pagetemplate.py	2008-11-15 13:57:00 UTC (rev 92965)
+++ five.pt/trunk/src/five/pt/pagetemplate.py	2008-11-15 14:00:58 UTC (rev 92966)
@@ -3,6 +3,7 @@
 
 from zope.app.pagetemplate.viewpagetemplatefile import ViewMapper
 
+from Acquisition import aq_get
 from Acquisition import aq_inner
 from Globals import package_home
 
@@ -18,32 +19,28 @@
 
 
     def render(self, view, default_namespace=None):
-        try:
-            root = self.getPhysicalRoot()
-        except AttributeError:
-            try:
-                root = view.context.getPhysicalRoot()
-            except AttributeError:
-                root = None
-
         context = aq_inner(view.context)
+        request = view.request
 
+        # get the root
+        root = None
+        meth = aq_get(context, 'getPhysicalRoot', None)
+        if meth is not None:
+            root = meth()
+
         def template(*args, **kwargs):
-            # Next is faster that IUserPreferedLanguages
-            language = view.request.get('I18N_LANGUAGE', None)
             namespace = dict(
                 view=view,
                 context=context,
-                request=view.request,
-                _context=view.request,
+                request=request,
+                _context=request,
                 template=self,
                 here=context,
                 container=context,
                 nothing=None,
                 root=root,
                 modules=SecureModuleImporter,
-                views=ViewMapper(context, view.request),
-                target_language=language,
+                views=ViewMapper(context, request),
                 options=kwargs)
             if default_namespace:
                 namespace.update(default_namespace)
    
    
More information about the Checkins
mailing list