[Product-Developers] How to traverse to / fetch a specific viewlet programatically

Andreas Jung lists at zopyx.com
Thu Aug 28 11:35:58 UTC 2008



--On 28. August 2008 13:28:06 +0200 Andreas Jung <lists at zopyx.com> wrote:

>
>
> --On 28. August 2008 13:01:42 +0200 Hedley Roos <hedleyroos at gmail.com>
> wrote:
>
>> Hi Andreas
>>
>> I'm porting old code and I need to call a macro that now lives in a
>> viewlet (or more correctly in the page template that is rendered by
>> the viewlet). The macro call is from trusted code (I handle an ajax
>> call), so I have access to the whole API.
>
> I assume that viewlet manager are registered as named utilities, so you
> might be able to lookup the related viewlet manager first using
>
>  vm = getUtility(IViewletManager, name='portal.xxxxx')
>

Your solution is possibly the right one (using multi adapters). Also the 
metaconfigure.zcml of zope.viewlet indicates that viewlet managers must be 
looked up as named (multi) adapters.

Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: not available
URL: <http://lists.plone.org/pipermail/plone-product-developers/attachments/20080828/b1387216/attachment.asc>


More information about the Product-Developers mailing list