Best way to set up a Product with multiple classes?
I want to create a Product which allows creation of an container object which has a number of subobjects and sub-subobjects which can be separately instantiated within it. The subobjects should only be able to be created in the appropriate container object defined within the Product. I know how to do this (or something adequately similar, anyway) with ZClasses within a Product, but I don't understand how to do this with Python classes in a Python product. If the answer to that is too easy, I have a second question. Can I make a such a subobject be permitted in a finite number of containter types, so for instance a FloweringPlant could be added to a Garden or a Florist but not to any other container type? Thanks for any suggestions, Matt Wilbert ___________________________________________________________________________ Visit http://www.visto.com/info, your free web-based communications center. Visto.com. Life on the Dot.
you have to override the def all_meta_types(self): method of OFS/ObjectManager in your product this method returns the allowed meta_types for subobjects cu ----- Original Message ----- From: "Matthew Wilbert" <mwilbert@alum.mit.edu> To: <zope@zope.org> Sent: Wednesday, May 02, 2001 3:21 AM Subject: [Zope] Best way to set up a Product with multiple classes? I want to create a Product which allows creation of an container object which has a number of subobjects and sub-subobjects which can be separately instantiated within it. The subobjects should only be able to be created in the appropriate container object defined within the Product. I know how to do this (or something adequately similar, anyway) with ZClasses within a Product, but I don't understand how to do this with Python classes in a Python product. If the answer to that is too easy, I have a second question. Can I make a such a subobject be permitted in a finite number of containter types, so for instance a FloweringPlant could be added to a Garden or a Florist but not to any other container type? Thanks for any suggestions, Matt Wilbert ___________________________________________________________________________ Visit http://www.visto.com/info, your free web-based communications center. Visto.com. Life on the Dot. _______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (2)
-
Matthew Wilbert -
zope-mailinglist