[Zope3-dev] Re: adapter registration - sort of works :-S

Philipp von Weitershausen philipp at weitershausen.de
Thu Nov 16 19:47:25 EST 2006


Paul Winkler wrote:
> On Thu, Nov 16, 2006 at 10:21:09AM +0100, Philipp von Weitershausen wrote:
>>> How would I _really_ return None from an adapter?
>> You don't. You call the adaption with a default value (e.g. None) to 
>> cover for the "coudln't adapt" case:
>>
>>   >>> getAdapter('moo', DateTime, None)
> 
> That doesn't work, getAdapter() doesn't have a default arg.
> 
> I think what you meant is:
>>>> queryAdapter('moo', DateTime, default='xyz')
> 'xyz'

Yes, thanks.


-- 
http://worldcookery.com -- Professional Zope documentation and training


More information about the Zope3-dev mailing list