Martin Aspeli schrieb:
Daniel Widerin wrote:
Hello,

I need some portlets to be rendered (i need their rendered html code) in browser view. these portlets expect only one parameter, an object_uid, which i passed to portlet renderer successfully.

Why? :)

It sounds to me like you should just do this with views or ViewPageTemplateFiles or viewlets.

i want to select portlets in kupu using mediaobjects to make "content portlets" being rendered in kupu-text.

i added some of my custom types (which all have a portlet too) to mediaobject resource types in kupu configuration to make them selectable using the place-image-button.

i added these types into the action-url table in kupu configuration
preview: string:++resource++gesundesleben.theme.images/contentPluginPreview_${portal_type}.gif?ContentPluginUrl=${object_url}
normal image:
string:++resource++gesundesleben.theme.images/contentPlugin_${portal_type}.gif?ContentPluginUrl=${object_url}

now i can add my types using placeholder images into my kupu text, and give them image-left, image-right classes to make text float around.

on save i replace ${object_url} with physicalpath of the selected object. (sorry, but only portal_type and object_url are available in kupu resource types configuration).

in my browser view, i parse the kupu-text and replace all images with img-tags which use the contentPlugin_${portal_type}.gif?ContentPluginUrl=${object_url} scheme with the rendered portlet code. through the physicalpath i can locate the object and then get the rendered portlet using an adapter with my own factory.

i hope you understand what i'm trying to do here, i know it's not a nice way but using the kupu place-image-button makes it very simple for reviewers to add such content portlets


i tried to call the portlet directly and construct the parameters for the render method, but still failed.

You need to be more specific about what you tried.

The general approach should be to get the portlet assignment, make sure it's acquisition-wrapped, and then adapt to IPortletRenderer, making sure the portlet renderer is acquisition wrapped in the context, and then call update() and then render() on it.

You'll need to look at the portlet manager code, in particular _lazyLoadPortlets().

i get a Unauthorized Exception in DC.Bindings as described here: http://plone.org/documentation/error/unauthorized-not-authorized-to-access-binding-context

i still get the unauthorized exception - but it works if i do a
except Unauthorized:
    pass

instead of raising the UnauthorizedBindingException. I think i have to search the right context for doing such things...


how do i construct a portlet-manager in python (tried some stuff from plone.portlets.manager already), do i need one?

Probably not, strictly speaking, but portlets weren't really designed to be easily rendered in isolation. It's certainly possible - you could look at some of tests in plone.app.portlets for inspiration - it's just not a use case that's considered particularly important.

Martin

thanks for help, it took me some steps ahead...
daniel






_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to