[Zope-dev] zope.component: calling an Interface and calling queryAdapter give differing results
Dieter Maurer
dieter at handshake.de
Mon Sep 1 13:21:16 EDT 2008
Philipp von Weitershausen wrote at 2008-9-1 14:07 +0200:
> ...
>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.:
>
> 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
>
>etc.
>
>Personally I would favour such consistency higher than the current
>behaviour, which may have been invented intentionally but still causes
>confusion once in a while.
I am with you in this respect (as you probably already knew) :-)
--
Dieter
More information about the Zope-Dev
mailing list