Back to index

plone3  3.1.7
displayviewsmenu.py
Go to the documentation of this file.
00001 from zope.component import getAdapters
00002 from zope.interface import implements
00003 from zope.app.publisher.browser.menu import BrowserMenu
00004 
00005 from interfaces import IDisplayViewsMenu
00006 
00007 
00008 class DisplayViewsMenu(BrowserMenu):
00009 
00010     implements(IDisplayViewsMenu)
00011 
00012     def getMenuItemByAction(self, object, request, action):
00013         # Normalize actions; strip view prefix
00014         if action.startswith('@@'):
00015             action = action[2:]
00016         if action.startswith('++view++'):
00017             action = action[8:]
00018 
00019         for name, item in getAdapters((object, request),
00020                                       self.getMenuItemType()):
00021             item_action = item.action
00022             # Normalize menu item action; never uses ++view++
00023             if item_action.startswith('@@'):
00024                 item_action = item_action[2:]
00025 
00026             if item_action == action:
00027                 return item