[Checkins] SVN: Products.CMFCore/trunk/Products/CMFCore/Expression.py - made sure we always can access the setup tool and run the upgrade step

Yvo Schubbe y.2011 at wcm-solutions.de
Tue Sep 13 05:13:28 EST 2011


Log message for revision 122786:
  - made sure we always can access the setup tool and run the upgrade step

Changed:
  U   Products.CMFCore/trunk/Products/CMFCore/Expression.py

-=-
Modified: Products.CMFCore/trunk/Products/CMFCore/Expression.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/Expression.py	2011-09-13 09:22:16 UTC (rev 122785)
+++ Products.CMFCore/trunk/Products/CMFCore/Expression.py	2011-09-13 10:13:28 UTC (rev 122786)
@@ -22,6 +22,7 @@
 from Products.PageTemplates.Expressions import getEngine
 from Products.PageTemplates.Expressions import SecureModuleImporter
 from zope.component import getUtility
+from zope.component.interfaces import ComponentLookupError
 
 from Products.CMFCore.interfaces import IMembershipTool
 from Products.CMFCore.utils import getToolByName
@@ -89,7 +90,11 @@
     '''
     An expression context provides names for TALES expressions.
     '''
-    mtool = getUtility(IMembershipTool)
+    try:
+        mtool = getUtility(IMembershipTool)
+    except ComponentLookupError:
+        # BBB: fallback for CMF 2.2 instances
+        mtool = getToolByName(portal, 'portal_membership')
     if object is None:
         object_url = ''
     else:



More information about the checkins mailing list