Back to index

plone3  3.1.7
Public Member Functions
plone.app.kss.commands.refreshportlet.RefreshPortletCommand Class Reference
Inheritance diagram for plone.app.kss.commands.refreshportlet.RefreshPortletCommand:
Inheritance graph
[legend]
Collaboration diagram for plone.app.kss.commands.refreshportlet.RefreshPortletCommand:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def refreshPortletLegacy
def refreshPortlet

Detailed Description

Definition at line 13 of file refreshportlet.py.


Member Function Documentation

Definition at line 37 of file refreshportlet.py.

00037 
00038     def refreshPortlet(self, portlethash, **kw):
00039         'Refresh portlet by its hash (new portlets)'
00040         # put parameters on the request, by saving the original context
00041         self.request.form, orig_form = kw, self.request.form
00042         # Prepare the portlet and render the data
00043         info = unhashPortletInfo(portlethash) 
00044         manager = getUtility(IPortletManager, info['manager'])
00045         assignment = assignment_from_key(context = self.context, 
00046                                          manager_name = info['manager'], 
00047                                          category = info['category'],
00048                                          key = info['key'],
00049                                          name = info['name'])
00050         renderer = getMultiAdapter(
00051                 (self.context, self.request, self.view, manager, assignment.data),
00052                 IPortletRenderer
00053             )
00054         renderer = renderer.__of__(self.context)
00055         renderer.update()
00056         if IDeferredPortletRenderer.providedBy(renderer):
00057             # if this is a deferred load, prepare now the data
00058             renderer.deferred_update()
00059         result = renderer.render()
00060         # Revert the original request
00061         self.request.form = orig_form
00062         # Command the replacement
00063         wrapper_id = 'portletwrapper-%s' % portlethash
00064         ksscore = self.getCommandSet('core')
00065         ksscore.replaceInnerHTML(ksscore.getHtmlIdSelector(wrapper_id), result)

Here is the call graph for this function:

def plone.app.kss.commands.refreshportlet.RefreshPortletCommand.refreshPortletLegacy (   self,
  name,
  nodeid = None,
  kw 
)

Definition at line 17 of file refreshportlet.py.

00017 
00018     def refreshPortletLegacy(self, name, nodeid=None, **kw):
00019         'Refresh portlet by name (old portlets)'
00020         if name.startswith('portlet-'):
00021             name = name[8:]
00022         if nodeid is None:
00023             nodeid = name
00024         # render it
00025         portlet_body = self.view.macroContent('portlet_%s/macros/portlet' % (name, ), **kw)
00026         # Good. Now, unfortunately we don't have any marker on the outside div.
00027         # So we just select the <dl> for insertion.
00028         # This could be spared with smarter templating.
00029         soup = BeautifulSoup(portlet_body)
00030         tag = soup.find('dl', id=nodeid)
00031         result = unicode(tag)
00032         # Command the replacement
00033         ksscore = self.getCommandSet('core')
00034         ksscore.replaceHTML(ksscore.getHtmlIdSelector(nodeid), result)

Here is the call graph for this function:


The documentation for this class was generated from the following file: