[Checkins] SVN: CMF/branches/2.1/CMFCore/UndoTool.py Use queryUtility to get the site root so we do not have to rely on acquisition

Wichert Akkerman wichert at wiggy.net
Sun Apr 15 18:28:16 EDT 2007


Log message for revision 74161:
  Use queryUtility to get the site root so we do not have to rely on acquisition

Changed:
  U   CMF/branches/2.1/CMFCore/UndoTool.py

-=-
Modified: CMF/branches/2.1/CMFCore/UndoTool.py
===================================================================
--- CMF/branches/2.1/CMFCore/UndoTool.py	2007-04-15 22:04:24 UTC (rev 74160)
+++ CMF/branches/2.1/CMFCore/UndoTool.py	2007-04-15 22:28:15 UTC (rev 74161)
@@ -21,8 +21,10 @@
 from OFS.SimpleItem import SimpleItem
 from zope.interface import implements
 
+from zope.component import queryUtility
 from ActionProviderBase import ActionProviderBase
 from exceptions import AccessControl_Unauthorized
+from interfaces import ISiteRoot
 from interfaces import IUndoTool
 from interfaces.portal_undo import portal_undo as z2IUndoTool
 from permissions import ListUndoableChanges
@@ -69,7 +71,11 @@
         '''Lists all transaction IDs the user is allowed to undo.
         '''
         # arg list for undoable_transactions() changed in Zope 2.2.
-        portal = self.aq_inner.aq_parent
+        portal = queryUtility(ISiteRoot)
+        if site is None:
+            # fallback
+            portal = self.aq_inner.aq_parent
+
         transactions = portal.undoable_transactions(
             first_transaction=first_transaction,
             last_transaction=last_transaction,



More information about the Checkins mailing list