[Zope] Re: meta_type in DTML returns incorrect type
Dario Alcocer
alcocer at helixdigital.com
Sun Jan 4 10:17:54 EST 2004
Dieter Maurer wrote:
> Dario Alcocer wrote at 2004-1-1 13:47 -0800:
>
>> I'm working with the AddressBook example from the book, "Zope
>> Bible". The example uses the following to conditionally display an
>> edit link for an AddressBook entry in the object's index_html
>> (rendered via a DTMLFile() object):
>>
>> <dtml-if "meta_type=='AddressBook Entry'"> | <a
>> href="./editEntryForm">Edit Entry</a></dtml-if>
>>
>> However, this never renders an "Edit Entry" link because
>> meta_type's value is 'AddressBook' (i.e. the type of the containing
>> object) and not the expected value 'AddressBook Entry'. I've
>> verified this by printing out the type of self.meta_type.
>
>
> This means:
>
> either your "index_html" is "applied" to the "AddressBook" (and not
> an entry)
>
> or an "AddressBook Entry" does not have a "meta_type" attribute.
>
Well, after searching through the "Zope Bible", I came up with the
following work-around in the DTML file (patch attached.) Basically, I
had to avoid using meta_type, but I'm still not sure why it doesn't
work. I'm going to e-mail the authors to find out why.
Thanks for your help.
More information about the Zope
mailing list