[Zope3-dev] Re: adapter registration question
Chris Withers
chris at simplistix.co.uk
Tue Nov 21 05:55:28 EST 2006
Tres Seaver wrote:
> This doctest blows up on my machine when run against the Zope3 trunk:
>
> >>> from zope.component import getAdapter
> >>> from zope.component import provideAdapter
> >>> from zope.interface import Interface
> >>> from zope.interface import implements
> >>> class IFoo(Interface):
> ... pass
> >>> class Foo(object):
> ... implements(IFoo)
> >>> foo = Foo()
> >>> def get_a(x):
> ... return 'a'
> >>> def get_b(x):
> ... return 'b'
> >>> provideAdapter(get_a, adapts=(IFoo,), provides=str, name='a')
> >>> provideAdapter(get_b, adapts=(IFoo,), provides=str, name='b')
> >>> getAdapter(object=foo, interface=str, name='a')
> 'a'
> >>> getAdapter(object=foo, interface=str, name='b')
> 'b'
...and yet it works fine in Zope 2.9.4 :-S
> The first 'provideAdapter' call raises an exeption because 'str' doesn't
> have an '__iro__'.
I don't even know what an __iro__ is :-S
> The second *doesn't* raise, because the code which
> raised the first exception leaves an artifact in a module global.
>
> Bot lookups fail with 'ComponentLookupError'.
Yuk, sounds like a good candidate for the Zope 3 collector, no?
cheers,
Chris
--
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
More information about the Zope3-dev
mailing list