[Zope-CMF] New product and meta_type and portal_catalog

Pascal Samuzeau samuzeau@oreka.com
Wed, 04 Dec 2002 08:46:29 +0100


Hi Dieter,                                                            
                                                                      
You wrote me :                                                        
                                                                      
> The "manage_afterAdd/beforeDelete" handles cataloging.              
>                                                                     
> You either must derive from a class (usually must be the first one) 
> with the right "manage_afterAdd/beforeDelete" methods               
> or you need to provide your own one.                                
>                                                                     
> Note that when you inherit from two classes both with some method   
"m",                                                                  
> then you will get at most one of these methods called.              
> When all of them should be called, you need to define your own      
> "m" that does what you want.                                        
>                                                                     
>                                                                     
> Apparently, the "manage_afterAdd/beforeDelete" of "SkinnedFolder"   
> do not handle cataloging (as you found out).                        
>                                                                     
                                                                      
Just before to receive your mail, I've tried some ways. Here is my    
result. Until now, even if I understand a little what is happening, I 
can't find, by myself, a solution.                                    
                                                                      
I have a product as told before, just as                              
                                                                      
...                                                                   
class MyProduct(SkinnedFolder)                                        
...                                                                   
                                                                      
As I told you before, I've tested with and without manage_afterAdd.   
With manage_afterAdd, MyProduct is not catalogued.                    
                                                                      
There is no more manage_afterAdd in SkinnedFolder (maybe still one    
upon...?)                                                             
                                                                      
The second way, the latest way for me that I need to use was 2        
Products ( in the same file)                                          
                                                                      
...                                                                   
class MyProductA(SkinnedFolder)                                       
                                                                      
  def manage_afterAdd(..):                                            
   # calling here an instance of MyProductB                           
...                                                                   
                                                                      
class MyProductB(MyProductA)                                          
...                                                                   
                                                                      
                                                                      
In MyProductB, I haven't a manage_afterAdd method.                    
                                                                      
                                                                      
When I test it, I've had had a good surprise.                         
                                                                      
MyProductA is NOT catalogued.                                         
MyProductB IS catalogued.                                             
                                                                      
So, it seems that manage_afterAdd DOESN'T handle cataloging, in this  
context.                                                              
                                                                      
I've tried to force to reindexObject, but without any success too.    
                                                                      
If you have any idea or explanation, I will listen to you carefully.  
                                                                      
Cheers                                                                
PS                                                                    
--------------------------------------------------                    
Oreka ! Nous sommes l'internet moins cher !                           
Surfez 25% moins cher avec http://www.oreka.com