[Zope] Restricting object types in container

Oliver Bleutgen myzope@gmx.net
Tue, 17 Sep 2002 10:28:21 +0200


Michael S. Fischer wrote:
> I'm trying to build a product for the first time -- please bear with me
> if I have lots of questions!
> 
> My first one is: 
> 
> I'm building a container object which is a subclass ObjectManager.  The
> ZDG says it's possible for my object to restrict the types of objects
> that can be contained within, but the example given to set the
> meta_types tuple doesn't appear to work -- instead, it appears to add an
> entry to the available objects list rather than exclude all others.
> 
> Does anyone know of a way in which I can explicity declare which object
> classes can be contained within a container class in Zope 2.5.1?
> 
> Thanks,
> 

Hi Michael,

_allowed_meta_types = ('DTMLMethod','File','Image',)

does what you want.

Since you are at the start of your project, maybe look at MaxM's easy 
product, here's an howto:

http://www.zope.org/Members/maxm/HowTo/easyProduct

While we are at it, he has also nice howtos for a "minimal product" 
which might help:

http://www.zope.org/Members/maxm/


cheers,
oliver