[Zope-dev] zope.component: calling an Interface and calling queryAdapter give differing results
Dieter Maurer
dieter at handshake.de
Mon Sep 1 13:26:23 EDT 2008
Chris Withers wrote at 2008-9-1 16:23 +0100:
> ...
>> 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?
One way would be to use "*objs" in the "Interface.__call__" signature.
Then, multi-adaptation could be "I(obj1, obj2, ...)" and
tuple adaptation "I((obj1, obj2, ...)).
Of course, all other parameters would need to be keyword parameters
(a good thing).
Do you have a serious use case for tuple adaptation?
--
Dieter
More information about the Zope-Dev
mailing list