[Zope] (no subject)

Dylan Reinhardt zope@dylanreinhardt.com
Mon, 10 Feb 2003 07:23:27 -0800


At 06:08 AM 2/10/2003, Patrick Stinson wrote:
>what's the easiest way to determine if an object is an anstance of a class?
>
>like
>
><dtml-in objectValues>
>    // if squence-item == some_class
>    // do this
></dtml-in>

By class, I'm assuming you mean meta_type, yes?

First off, you can do this:

<dtml-in "objectValues('Folder')">
    <dtml-var title_or_id>
</dtml-in>

If all you want are the objects of a given meta type.  The argument passed 
to objectValues can also be a list of meta_types.

If you actually want to branch on an object's meta type, try:

<dtml-in objectValues prefix=my>
    <dtml-if "my_item.meta_type == 'Folder'">
</dtml-in>

HTH,

Dylan