Re: [Zope3-dev] Re: calling interface returns object, calling queryAdapter returns None?

2007-01-25 Thread Dieter Maurer
Jim Fulton wrote at 2007-1-25 09:11 -0500: > ... >I disagree with this assertion for the reason that Marius stated, >which is that adapters are factories and utilities are not. I Should I be really interested in this implementation detail? All I care of, is that the returned object implement

Re: [Zope3-dev] Re: calling interface returns object, calling queryAdapter returns None?

2007-01-25 Thread Jim Fulton
On Jan 24, 2007, at 8:44 PM, Tres Seaver wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Chris Withers wrote: Fred Drake wrote: On 1/24/07, Chris Withers <[EMAIL PROTECTED]> wrote: queryAdapter, for me, is "starting with the supplied object, get me something that implements the supplie

[Zope3-dev] Re: calling interface returns object, calling queryAdapter returns None?

2007-01-25 Thread Chris Withers
All the following are great, especially the (SF) ones ;-) Tres Seaver wrote: >>> from zope.interface import Interface, Attribute >>> from zope.interface import implements, directlyProvides >>> from zope.component import provideUtility, provideAdapter, adapts >>> class IFoo(Interface):

Re: [Zope3-dev] Re: calling interface returns object, calling queryAdapter returns None?

2007-01-25 Thread Marius Gedminas
On Wed, Jan 24, 2007 at 08:44:31PM -0500, Tres Seaver wrote: > Note that for regularity, I assert that the calling the IFoo interface > should allow the follwing use cases, based on the asserition that > utilities are "zero-order" adapters, just as views are "binary order" > adapters. There is a v

[Zope3-dev] Re: calling interface returns object, calling queryAdapter returns None?

2007-01-24 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Chris Withers wrote: > Fred Drake wrote: >> On 1/24/07, Chris Withers <[EMAIL PROTECTED]> wrote: >>> queryAdapter, for me, is "starting with the supplied object, get me >>> something that implements the supplied interface and return None if no >>> such

Re: [Zope3-dev] Re: calling interface returns object, calling queryAdapter returns None?

2007-01-24 Thread Chris Withers
Fred Drake wrote: On 1/24/07, Chris Withers <[EMAIL PROTECTED]> wrote: queryAdapter, for me, is "starting with the supplied object, get me something that implements the supplied interface and return None if no such object can be obtained". o = IFoo(ob, None) if os is not None: Ah, now that

Re: [Zope3-dev] Re: calling interface returns object, calling queryAdapter returns None?

2007-01-24 Thread Chris Withers
Jim Fulton wrote: If there's another function which does this, fine, if not, then I maintain the current behaviour is not correct... Chris, documented behavior is not incorrect just because you expect otherwise. Indeed, sorry, that's not what I meant, although I can see it came across like

Re: [Zope3-dev] Re: calling interface returns object, calling queryAdapter returns None?

2007-01-24 Thread Fred Drake
On 1/24/07, Chris Withers <[EMAIL PROTECTED]> wrote: queryAdapter, for me, is "starting with the supplied object, get me something that implements the supplied interface and return None if no such object can be obtained". o = IFoo(ob, None) if os is not None: ... If there's another funct

Re: [Zope3-dev] Re: calling interface returns object, calling queryAdapter returns None?

2007-01-24 Thread Jim Fulton
On Jan 24, 2007, at 5:37 PM, Chris Withers wrote: Laurence Rowe wrote: From the Interface.__call__ docstring: "If an object already implements the interface, then it will be returned" queryAdapter is looking in the adapter registry. You have not registered any adapters. So this looks like t

Re: [Zope3-dev] Re: calling interface returns object, calling queryAdapter returns None?

2007-01-24 Thread Chris Withers
Laurence Rowe wrote: From the Interface.__call__ docstring: "If an object already implements the interface, then it will be returned" queryAdapter is looking in the adapter registry. You have not registered any adapters. So this looks like the expected behaviour to me. Documented maybe, ex

[Zope3-dev] Re: calling interface returns object, calling queryAdapter returns None?

2007-01-24 Thread Laurence Rowe
Chris Withers wrote: Hot on the heels of my multi-adapter problem: http://mail.zope.org/pipermail/zope3-dev/2007-January/021600.html ...which I'm still waiting for guidance on, I now find that queryAdapter and calling an interface behave unexpectedly differently in the case where an object di