[Zope3-Users] Re: Get classes implementing Interface
mailinglists at xgm.de
Sat Dec 31 11:21:45 EST 2005
Does anyone got this mail? I've not received a copy from the mailinglists
neither it shows up in the archives...
Am Freitag, 30. Dezember 2005 20:57 schrieb Jeff Shell:
> On 12/30/05, Florian Lindner <mailinglists at xgm.de> wrote:
> > Am Freitag, 30. Dezember 2005 17:45 schrieb Jim Fulton:
> > > Philipp von Weitershausen wrote:
> > > > 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?
> Well first (and I apologize if this has been mentioned before),
> 'containers' are a more abstract notion while 'folders' are more
> concrete. A message or document that allows comments might be a
> container, but it's not something that you'd see in the ZMI or any
> content management type interface as a folder. You'd see it as an
> Something that's "Folderish" (to drag up an old term) will probably
> have a folder icon, will probably (but not necessarily) will have
> sub-folders, will have a view to manage its contents, and so on.
Basically the HomeFolderManager (HFM) only creates an 1:1 relation between a
principal and an object. It can also auto-create these objects if the
relation is being read for the first time. In this case the object to be
created is hardcoded to be a zope.app.folder.Folder. The HFM does not care
what is being done with the objects it just returns them.
In my project I've another folderish object that I want to have created,
therefore I forked the HFM and modified the code to create the object I want.
Of course, the common use case would be to create a folderish object, but any
other kind of objects would make sense to. A principal could have a home page
(just one site) which is not folderish neither a IContainer which could the
HFM return. Or a project which can contain comments, which is not folderis
either but is an IContainer implemention.
I think that the HFM should allow creation of ANY objects, regardless of being
folderish or IContainer implemenations. Of course, the name HomeFOLDERManager
would not make sense anymore in this case.
What do you think?
I've included zope-dev in the recipients.
More information about the Zope3-users