[Zope3-Users] Re: Get classes implementing Interface
Florian Lindner
mailinglists at xgm.de
Mon Feb 6 10:09:44 EST 2006
Am Montag, 6. Februar 2006 12:19 schrieb Stephan Richter:
> On Sunday 08 January 2006 10:01, Florian Lindner wrote:
> > I do it this way now:
> >
> > utils = getUtilitiesFor(IFactory)
> > self.objects = {}
> > for i in utils:
> > if IContainer in i[1].getInterfaces():
> >
> > the UtilityVocabulary gives the same result as getUtilitiesFor.
> > But that does not list all classes, for example there is no class of the
> > normal Folder.
>
> This is bad and I think a bug. Could you report it as an issue or even
> investigate it further and make a suggestion?
I'm not sure if I described it correctly. I've the following code:
def __call__(self):
from zope.app.zapi import *
from zope.component.interfaces import IFactory
from zope.app.container.interfaces import IContainer
utils = getUtilitiesFor(IFactory)
for i in utils:
if "zope.app.content.Folder" == i[0]:
import pdb; pdb.set_trace()
at the breakpoint:
(Pdb) i
(u'zope.app.content.Folder', <Factory for <class
'zope.app.folder.folder.Folder'>>)
(Pdb) i[1].getInterfaces()
<implementedBy zope.app.folder.folder.Folder>
(Pdb) IContainer in i[1].getInterfaces()
False
Should the latter return True? If yes and therefore it is a bug I'll try to
investigate if further and/or report an issue.
Florian
More information about the Zope3-users
mailing list