portlet reference from hash code

Martin Aspeli optilude at gmx.net
Tue Aug 14 21:25:27 UTC 2007


Hi Nicola,

> I'm now developing a little tool using plone 3 and kss, something like "drag
> and drop" behavour.

Cool - I'm interested in that. Which toolkit are you using?

> I need to obtain a portlet reference by its hash code.

<snip code />

> How to obtain this portlet reference? Varius portlet must have different
> menu ;)

Are you asking how to get a portlet hash, or how to turn a portlet hash 
into an actual portlet?

If you have a hash, you can get a portlet info dict from 
plone.portlets.utils.unhashPortletInfo()

With this info, you can call 
plone.app.portlets.utils.assignment_from_key() which returns an 
IPortletAssignment.

Look at plone.app.portlets.browser.kss to see how it's used. If you need 
to render the assignment, multi-adapt assignment.data to IPortletRenderer.

The hashes themselves are stored in the page template. You can use a 
kssAttr() type attribute to find them and send them to the server-side 
action.

Martin


-- 
Acquisition is a jealous mistress





More information about the Product-Developers mailing list