[Zope-dev] Manipulating Meta-Type Global Add list on per-instance basis

Tres Seaver tseaver@palladion.com
Tue, 29 Feb 2000 18:23:31 -0600


Josh Zeidner wrote:
> 
> Hmm... possibly I did not explain my needs :
> 
>   What I need to do is manipulate the attribute of a "folderish" object (
> ie. an object that can contain other objects ) that determines what objects
> are allowed to be contained by my object.  I need to do this at
> instantiation time , *NOT* definition time.

That is what I was targeting -- I guess my implementation wasn't limpidly
transparent.

> 
>   I seemed to have accomplished this by manipulating the "meta_types"
> attribute...  but is this a valid way to attain this behavior?

That is a more straightforward option than I proposed below -- my code _filters_
the available meta_types based on a tokens/list instance property -- the catch
is that you have to replace the standard "contents" view in order to get my code
used (I am not really changing what _could_ be added;  I merely change the list
presented to the user.)

Munging the meta_types attribute is actually an interesting idea -- "normal"
Python product objects have the meta_types attribute as a class member;  so in
fact, you are "hiding" the class member when you assign to the instance
attribute.  If you ever want to "recover to original," you should be able to
just "del self.meta_types" hand have it reappear, presto-changeo.

Glad you found a solution.

Tres.
-- 
=========================================================
Tres Seaver         tseaver@palladion.com    713-523-6582
Palladion Software  http://www.palladion.com