[Zope3-Users] Re: Get classes implementing Interface

Philipp von Weitershausen philipp at weitershausen.de
Fri Dec 30 07:30:18 EST 2005

Florian Lindner wrote:
> my first use case is that I want to enhance the HomefolderManager to make it 
> possible to select something else than a Folder to be created automatically. 
> Right now I have forked a version of the HomefolderManager and just changed 
> in the code. But I would like to have a more generic solution and I'll also 
> commit it back to the trunk.
> For that I want all classes implementing IContainer (and IContentType ?) and 
> let the user select on in the configuration dialog of the HomefolderManager.
> More use caess probably show up in my project later, but nothing fixed at this 
> time.

So what you want is to create objects. Classes are just an
implementation detail to creating objects :). Factories create objects,
whether they're from a class is immaterial.

So, what you want is not a list of classes but a list of factories that
can create IContainers. This is possible by using
zapi.getUtilitiesFor(IFactory) and then checking each factory's
getInterfaces() method whether IContainer is a part of the returned
result. I would probably base an implementation of all on the


More information about the Zope3-users mailing list