Back to index

plone3  3.1.7
refreshContentMenu.py
Go to the documentation of this file.
00001 from zope.deprecation import deprecate
00002 from zope.component import getMultiAdapter
00003 from zope.interface import alsoProvides
00004 from kss.core import CommandSet
00005 from plone.app.layout.globals.interfaces import IViewView
00006 from zope.contentprovider.interfaces import IContentProvider
00007 
00008 # XXX: This is deprecated and will be removed in Plone 4.0. Use the 'plone'
00009 # command set instead.
00010 class KSSRefreshContentMenu(CommandSet):
00011     """
00012     Refresh a viewlet
00013     """
00014 
00015     @deprecate("The 'contentmenu' command set is deprecated and will be removed in Plone 4.0. "
00016               "Please use the 'plone' command set instead.")
00017     def refreshContentMenu(self, id, name):
00018         alsoProvides(self.view, IViewView)
00019         contentMenu = getMultiAdapter((self.context, self.request, self.view), 
00020                                       IContentProvider, name=name)
00021         renderer = contentMenu.__of__(self.context)
00022         renderer.update()
00023         result = renderer.render()
00024         ksscore = self.getCommandSet('core')
00025         ksscore.replaceHTML(ksscore.getHtmlIdSelector(id), result)
00026 
00027