[Zope-CMF] How to get the inherited's meta_type in DTML ?

Dieter Maurer dieter@handshake.de
Tue, 10 Dec 2002 20:11:14 +0100


Pascal Samuzeau writes:
 > I have an URL as :                                                    
 >                                                                       
 > http://mysite/myobject/mydtmldocument                                 
 >                                                                       
 > In mydtmldocument I need to know what is the meta_type of myobject.   
 >                                                                       
 > So I did :                                                            
 > ...                                                                   
 > <dtml-if "_.getattr(this(), 'meta_type') == 'TypeX'">                 
 > <dtml-call expr="REQUEST.set('typehere',this().getId())">             
 > ...                                                                   
 >                                                                       
 > But my problem, is that I am able to call "mydtmldocument" anywhere,  
 > by acquisition as sample :                                            
 >                                                                       
 > http://mysite/myobject/myfolders/myfolder/thisfolder/mydtmldocument.  
If you are interested in the meta type of "thisfolder" in this
case, you can use "REQUEST.PARENTS[0].meta_type".

If you are interested in the one of "myobject", you must find
"myobject". You could use acquisition (not very safe)
or iterate over "PARENTS" (a sequence) or make a catalog search
or ...


Dieter