[Zope-dev] zope.component: calling an Interface and calling queryAdapter give differing results
Jim Fulton
jim at zope.com
Tue Sep 2 11:51:22 EDT 2008
On Sep 1, 2008, at 12:33 PM, Philipp von Weitershausen wrote:
> El 1 Sep 2008, a las 17:23 , Chris Withers escribió:
>> Philipp von Weitershausen wrote:
>>> I've personally thought for some time that it would be quite nice
>>> if all you had to do was call an interface to look up a utility
>>> (which is sort of a multi-adapter of order 0) or to do some kind
>>> of adaption, no matter how many objects you wanted to adapt. E.g.:
>>
>> +sys.maxint. This is nice.
>>
>>> auth = IAuthentication() # utility
>>> auth = IAuthentication(default=None)
>>> langs = IUserPreferredLanguages(request) # adapter
>>> langs = IUserPreferredLanguages(request, default=None)
>>> view = IBrowserPage((obj, request), name='index') # named
>>> multi-adapter
>>
>> Right, but how do you differentiate adapting a tuple to IBrowserPage
>> versus adapting obj and request together to IBrowserPage?
>
> You don't, I guess. I'd say that multi-adaption is *defined* as the
> adaption of a tuple.
Some people who use zope.interface reply on being able to singly adapt
tuples
Jim
--
Jim Fulton
Zope Corporation
More information about the Zope-Dev
mailing list