[Zope-dev] filter metatypes in objectmanager

2001-03-27 Thread Magnus Heino


How can I control what meta_type's that can be added to an ObjectManager?

If you create a ZClass that inherits from ObjectManager, you can specify 
this, but how is it done from a python product?

/Magnus


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] filter metatypes in objectmanager

2001-03-27 Thread Jens Vagelpohl

define a method with the name "all_meta_types" inside your class and have it
return the correct information, like this:



import Products

def all_meta_types(self):
""" What can you put inside me? """
f = lambda x: x['name'] in ('DTML Method', 'DTML Document')
return filter(f, Products.meta_types)



Products.meta_types contains information about all available meta types and
you need to filter out what you need.

jens




on 3/27/01 7:44, Magnus Heino at [EMAIL PROTECTED] wrote:

 
 How can I control what meta_type's that can be added to an ObjectManager?
 
 If you create a ZClass that inherits from ObjectManager, you can specify
 this, but how is it done from a python product?
 
 /Magnus


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )