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

Paul Winkler pw_lists at slinkp.com
Thu Nov 16 12:04:06 EST 2006


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'

-- 

Paul Winkler
http://www.slinkp.com


More information about the Zope3-dev mailing list