Mikko Ohtamaa | 19 Jun 2012 19:38

Portlet does not know proper assignment context when rendered?

Hi,

I want to confirm from the greater minds:

- Portlet does not have acquisition enabled assignment context when used in
Renderer:

 (Pdb) self.data
    <Acquisition.ImplicitAcquisitionWrapper object at 0x10f4f9410>
    (Pdb) self.data.aq_base
    <imageportlet.portlets.Assignment object at 0x1101c3050>

- Portlet, however, *does* know this when being accessed in add and edit
form, so it is possible to have:

 self.context
    <Assignment at
/Plone/fi/info/++contextportlets++plone.rightcolumn/assignment>

More info:

https://dev.plone.org/ticket/11838#comment:13

Could it be possible to modify portlet framework to pass the acquisition
chain aware assignment context to portlet renderers? As this would enable a
lot of widgets on the portlets themselves (namely, blobs and images and
such)?

What would be proper place to do the change (plone.app.portlet,
plone.portlet, etc.?)
(Continue reading)

Malthe Borch | 19 Jun 2012 20:32
Picon
Gravatar

Re: Portlet does not know proper assignment context when rendered?

On 19 June 2012 19:38, Mikko Ohtamaa
<mikko+plone@...> wrote:
> Could it be possible to modify portlet framework to pass the acquisition
> chain aware assignment context to portlet renderers? As this would enable a
> lot of widgets on the portlets themselves (namely, blobs and images and
> such)?

It's not possible because the parent object isn't part of the
acquisition-chain either.

I'm not an authority on portlets as such, but having just written
``collective.panels`` (shameless plug) I had a chance to study it in
some detail.

What you have is the renderer. It's got a ``context`` that you can build from.

\malthe

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
Enrique Pérez Arnaud | 20 Jun 2012 10:46
Picon
Favicon
Gravatar

Re: Portlet does not know proper assignment context when rendered?

Hi,

2012/6/19 Mikko Ohtamaa <mikko+plone@...>:
> Hi,
>
> I want to confirm from the greater minds:

I'm not sure I understand you correctly (not a greater mind here :),
but you can get the path to the assignment context in a contextually
assigned portlet through renderer.__portlet_metadata__['key']

https://github.com/plone/plone.portlets/blob/master/plone/portlets/README.txt#L954

__portlet_metadata__ is set on the renderer by the portlet manager on
load, and is not available in the __init__ of the renderer.

https://github.com/plone/plone.portlets/blob/master/plone/portlets/manager.py#L114

>
> - Portlet does not have acquisition enabled assignment context when used in
> Renderer:
>
>  (Pdb) self.data
>    <Acquisition.ImplicitAcquisitionWrapper object at 0x10f4f9410>
>    (Pdb) self.data.aq_base
>    <imageportlet.portlets.Assignment object at 0x1101c3050>
>
> - Portlet, however, *does* know this when being accessed in add and edit
> form, so it is possible to have:
>
(Continue reading)

Mikko Ohtamaa | 20 Jun 2012 12:30

Re: Portlet does not know proper assignment context when rendered?

Hi,

On Wed, Jun 20, 2012 at 11:46 AM, Enrique Pérez Arnaud <eperez-TWh9R00kwrs@public.gmane.org> wrote:
Hi,

2012/6/19 Mikko Ohtamaa <mikko+plone-75aZqqp77KCaMPzRcYMCawC/G2K4zDHf@public.gmane.org>:
> Hi,
>
> I want to confirm from the greater minds:

I'm not sure I understand you correctly (not a greater mind here :),
but you can get the path to the assignment context in a contextually
assigned portlet through renderer.__portlet_metadata__['key']

https://github.com/plone/plone.portlets/blob/master/plone/portlets/README.txt#L954

__portlet_metadata__ is set on the renderer by the portlet manager on
load, and is not available in the __init__ of the renderer.

https://github.com/plone/plone.portlets/blob/master/plone/portlets/manager.py#L114

So the data should be available there... just cunningly hidden behind underscores :) Now, let's see if it's possible to construct acquisition chain from this.

-Mikko

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Plone-developers mailing list
Plone-developers@...
https://lists.sourceforge.net/lists/listinfo/plone-developers

Gmane