In a product I am writing, I am trying to add a ComputedAttribute to an 
instance of a Folder descendant class.

This is the code I use:

     def addComputedAttribute(self, attributeName, sourceCode):
         methodName = '_ca_get%s' % attributeName
         self.addMethod(methodName, sourceCode)
         setattr(self, attributeName, 

where at first I defined ContextComputed Attribute like this:

     import ComputedAttribute

     _ComputedAttribute = ComputedAttribute.ComputedAttribute
     del ComputedAttribute

     class ContextComputedAttribute(_ComputedAttribute):

This put the Folder in a bad state : when I access it later, the Zope 
instance crashes.

So I supposed I needed to use a persistent Attribute and I tried with 
ContextComputedAttribute class defined like this:

     class ContextComputedAttribute(Persistent):
         def __init__(self, test):

In this case, the Folder stays in a good state but it does not fullfill the 
requirements as ContextComputedAttribute does not descend from the real 
Zope ComputedAttribute class.

My problem is the following :

I cannot define a class like this:

     import ComputedAttribute

     _ComputedAttribute = ComputedAttribute.ComputedAttribute
     del ComputedAttribute

     class ContextComputedAttribute(_ComputedAttribute, Persistent):

In this case, I get the following error

TypeError: too many datafull base classes

which has to do with too many ExtensionClass derivation...

Can someone tell me how to define a class with both ComputedAttribute and 
Persistent behaviours ?

Thanks a lot.


Godefroid Chapelle

BubbleNet sprl
rue Victor Horta, 30
1348 Louvain-la-Neuve

Tel + 32 (10) 457490
Mob + 32 (477) 363942

TVA 467 093 008
RC Niv 49849

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

Reply via email to