[Zope3-Users] Checking for existence of an adapter

Martin Aspeli optilude at gmx.net
Tue Jul 15 18:30:05 EDT 2008


Hi,

Is there some way to check whether an adapter exists without having 
something to adapt?

Specifically, I want to know if a particular view is registered for a 
particular type of context and request/layer, with a particular name. 
However, I don't have an instance of the object of that type, nor the 
request, at the time when I need to do the check.

I tried this, but it doesn't seem to work, at least not for globally 
registered views:

site_manager = getSiteManager(site)
addview_factory = site_manager.adapters.lookup((Implements(IAdding), 
Implements(IBrowserRequest)), IBrowserView, name=fti.factory)

Cheers,
Martin

-- 
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book



More information about the Zope3-users mailing list