[Zope] Determining object type

Joel Burton joel@joelburton.com
Wed, 6 Mar 2002 11:51:18 -0500 (EST)


On Wed, 6 Mar 2002, Phil Harris wrote:

> <dtml-in expr="(objectValues('type1')) + (objectValues('type2')">
>    <dtml-let mt="_.getitem('meta_type')">
>    <dtml-if "mt=='type 1'">
>         processing
>   <dtml-else>
>         processing
>   </dtml-if>
>   </dtml-let>
> </dtml-in>

Phil --

Why the "_.getitem('meta_type')" followed by separate if statement?

I'd have just done this as <dtml-if "meta_type=='xxx'">. Sometimes the
_.getitem is required (if you don't know the attribute name, if you want
to work w/o acquisition using aq_explicit, etc.).

I guess I'm asking: are you being overly cautious/verbose, or is there
some risk here in simply doing the </dtml-if meta_type> solution that I'm
overlooking?

-- 

Joel BURTON  |  joel@joelburton.com  |  joelburton.com  |  aim: wjoelburton
Independent Knowledge Management Consultant