Back to index

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