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.

Jim

--
Jim Fulton           mailto:[EMAIL PROTECTED]       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to