[Zope] How can you tell if what kind of object it is?

Martijn Pieters mj@antraciet.nl
Tue, 09 Nov 1999 22:15:42 +0100


At 21:57 9-11-99 , Adrian Esteban Madrid wrote:
>Is there something like _.isDTMLMethod, _.isDTMLDocument, _.isFolder
>hidden somewhere? I've been browsing the documentation but have not been
>able to figure this out. I need that to create a dynamic navigational
>bar that sshould get set like this:

Just check out the meta_type property of the object.


>       <dtml-call "REQUEST.set('fobs', [])"> <!-- Folders -->
>       <dtml-call "REQUEST.set('dobs', [])"> <!-- Documents -->
>       <!-- Fill Folders and Documents -->
>       <dtml-in "PARENTS[0].objectValues()" skip_unauthorized>
>         <dtml-let item="_.getitem('sequence-item', 0)">

This is not needed. The current item is on top of the namespace stack, any 
method or property is first searched for there.


>          <dtml-unless "hasProperty('hidden') and hidden">
>             <dtml-if "item.isFolder"> <!-- This is what I'm looking for!
>-->

   <dtml-if "meta_type == 'Folder'">

>               <dtml-call "fobs.insert(0, item)">
>             <dtml-elif "item.isDTMLMethod"> <!-- This is what I'm
>looking for! -->

   <dtml-if "meta_type == 'DTML Method'">

>               <dtml-call "dobs.insert(0, item)">
>             </dtml-if>
>           </dtml-unless>
>         </dtml-let>
>       </dtml-in>


--
Martijn Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| T: +31 35 7502100 F: +31 35 7502111
| mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
---------------------------------------------