On Wed, Jan 17, 2007 at 06:37:52AM -0800, Martin Aspeli wrote:
> Chris Withers wrote:
> > I was wondering if someone could give me a definitive explanation of 
> > what the following means:
> > 
> > <adapter
> >      for="* ISomething *"
> >      ...
> > 
> > ...means?
> > 
> > Is the following equivalent:
> > 
> > provideAdapter(...,adapts=(None,ISomething,None),...)
> 
> No, but this is:
> 
> provideAdapter(...,adapts=(Interface, ISomething, Interface),...)

As far as I know provideAdapter treats None the same way as Interface.
I've used this pattern a few times:

    from zope.adapter import adapts, provideAdapter
    from zope.interface import implements
    ...
    class SomeAdapter(object):
        adapts(None)
        implements(IFoo)
        ...

    provideAdapter(SomeAdapter)

BTW passing interfaces to provideAdapter/<adapts> is out of fashion.  I
prefer using zope.component.adapts and zope.interface.implements (or
zope.component.adapter and zope.interface.implementer, when my adapter
is a function rather than a class).

Marius Gedminas
-- 
America and England are two countries separated by a common language.

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to