[Product-Developers] How to traverse to / fetch a specific viewlet programatically
Andreas Jung
lists at zopyx.com
Thu Aug 28 11:28:06 UTC 2008
--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')
According to the zope.viewlet documentation you can access the associated
viewlets directly using
vm[viewlet_name]
Check with the zope.viewlet doctests in README.txt.
-aj
-------------- 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/b6869989/attachment.asc>
More information about the Product-Developers
mailing list