Hi All, I have a need to be able to adapting certain objects to None, eg:
def some_adapter(obj): if something: return None return somethingelse This is tricky, since returning None from an adapter results in a TypeError. I eventually came up with the idea of having a subclass of Interface do what I needed: empty = object() class IFieldType(Interface): def __call__(self,*args,**kw): r = Interface.__call__(*args,**kw) if r is empty: return None return r I suspect this would work with the python implementation of Interface, but it certainly doesn't with the C implementation. What am I doing wrong and how can I achieve what I'm after? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk _______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )