[Checkins] SVN: Products.CMFCore/trunk/Products/CMFCore/ActionInformation.py - added one more fallback

Yvo Schubbe y.2011 at wcm-solutions.de
Tue Sep 13 08:52:48 EST 2011


Log message for revision 122789:
  - added one more fallback

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

-=-
Modified: Products.CMFCore/trunk/Products/CMFCore/ActionInformation.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/ActionInformation.py	2011-09-13 11:15:39 UTC (rev 122788)
+++ Products.CMFCore/trunk/Products/CMFCore/ActionInformation.py	2011-09-13 13:52:47 UTC (rev 122789)
@@ -23,6 +23,7 @@
 from OFS.PropertyManager import PropertyManager
 from OFS.SimpleItem import SimpleItem
 from zope.component import getUtility
+from zope.component.interfaces import ComponentLookupError
 from zope.i18nmessageid import Message
 from zope.interface import implements
 
@@ -572,7 +573,11 @@
 
     def __init__( self, tool, folder, object=None ):
         self.portal = portal = aq_parent(aq_inner(tool))
-        mtool = getUtility(IMembershipTool)
+        try:
+            mtool = getUtility(IMembershipTool)
+        except ComponentLookupError:
+            # BBB: fallback for CMF 2.2 instances
+            mtool = getToolByName(tool, 'portal_membership')
         self.isAnonymous = mtool.isAnonymousUser()
         self.user_id = mtool.getAuthenticatedMember().getId()
         self.portal_url = portal.absolute_url()



More information about the checkins mailing list