20 Jun 2012 10:46
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: > > 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.?) > > Now I work around this case by storing site root relative path of the > assignment when the portlet is being added: > > https://github.com/miohtama/imageportlet/blob/master/imageportlet/portlets.py#L112 > > -Mikko > > > ----- > > Follow me in Twitter > > > > Read my blog > > > > > > -- > View this message in context: http://plone.293351.n2.nabble.com/Portlet-does-not-know-proper-assignment-context-when-rendered-tp7556366.html > Sent from the Core Developers mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > 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 -- -- Enrique Pérez Arnaud Yaco Sistemas S.L. | http://www.yaco.es C/ Rioja 5, 41001 Sevilla (España) Teléfono: (+34) 954 50 00 57 | Fax (+34) 954 50 09 29 ------------------------------------------------------------------------------ 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/
RSS Feed