[Zope3-Users] Re: Get classes implementing Interface

Florian Lindner mailinglists at xgm.de
Fri Dec 30 13:58:09 EST 2005

Am Freitag, 30. Dezember 2005 17:45 schrieb Jim Fulton:
> Philipp von Weitershausen wrote:
> > 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
> > UtilityVocabulary.
> I'll also note that the use case is also directly addressed through
> containment constraints.  You can say that a container
> should only contain objects of some given types and you will get
> just those types in the add list.

But the HomeFolderManager is not a container itself it's just a utility that 
creates container upon requests. And I want to make choosable which container 
to create. Or do I misunderstand you?


More information about the Zope3-users mailing list