[Zope] Defining meta_types
Jesper Holmberg
jesper.holmberg@enst-bretagne.fr
Tue, 13 Nov 2001 15:25:13 +0100
Hi all,
I've created a Product Step which is a subclass of Folder. I want restrict
what types of objects I can put in an object of type Step.
The "Developer's guide" has this to say on the subject:
"If you wish to control which types of objects can be contained by
instances of your product you can set the meta_types class attribute. This
attribute should be a tuple of meta_types."
I naively interpreted this such that I could put this in my class:
meta_types = ('Step', 'SURef',)
But this gives me the errors:
Error Type: AttributeError
Error Value: has_key
With the backtrace:
File /usr/lib/zope/lib/python/OFS/ObjectManager.py, line 271, in filtered_meta_types
(Object: Step)
So I found a tip on the Web, saying I could do this:
meta_types = ({'name':'Step', 'action':'manage_addStepForm'},)
Now, this doesn't give me an error, but the effect is that I get one more
Step as alternative on the drop-down menu "Select type to add..."
*in addition* to all the alternatives. But I wanted to restrict the
possibilities, not augment them.
What am I doing wrong?
TIA
Jesper
--
Jesper Holmberg |"But how can |
jesper.holmberg@enst-bretagne.fr | one be warm |
ENST Br, BP 832, 29285 Brest, FRANCE | alone?" |