El 1 Sep 2008, a las 19:26 , Dieter Maurer escribió:
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?
IIRC, the twisted guys do.