[Zope3-Users] Getting the most specific interface

Paul Wilson paulalexwilson at gmail.com
Thu Aug 27 08:19:17 EDT 2009


Hi,

I am wondering what the best way is to get the most specific interface
is from a class.

Relying on the first interface returned from 'implementedBy()' doesn't
feel right. I've found another post asking roughly this question that
uses 'queryType' [1], however that doesn't seem to be available these
days.

class IMyFoo(Interface):
   ...

class MyFoo(Bar):
   implements(IMyFoo)
   ...

>>> [x.__name__ for x in implementedBy(MyFoo)]
['IMyFoo', 'IBarFoo', ... ]

I want some reliable way of returning 'IMyFoo' but can't seem to find it...

Thanks,
Paul

[1] http://mail.zope.org/pipermail/zope3-dev/2005-September/015774.html


More information about the Zope3-users mailing list