[Zope-dev] component registry navelgazing

Charlie Clark charlie.clark at clark-consulting.eu
Mon Jun 13 10:26:53 EDT 2011


Hiya,

Am 12.06.2011, 22:48 Uhr, schrieb Chris McDonough <chrism at plope.com>:

>>>> from zope.component.registry import Components
>>>> c = Components()
>>>> from zope.interface import Interface, implements
>>>> class IFoo(Interface): pass
> ...
>>>> class Foo(object):
> ...     implements(IFoo)
> ...
>>>> foo = Foo()
>>>> c.queryAdapter(IFoo, foo)
> <None>

> In order to get the object itself back from such an adaptation, you need
> to use the default= argument.

I know that the question has been answered but your question makes me ask  
another: why would you want to adapt an object with itself?

Charlie
-- 
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-600-3657
Mobile: +49-178-782-6226


More information about the Zope-Dev mailing list