[Zope] DTML Problem (from the newbie "hair ripper" category)

Darin Lee dlee@usol.com
Sun, 16 Jul 2000 14:40:55 -0400


Greetings,

I have created a custom Zclass called "Category." This object is based on
the "objectManager" template. Essentially this object is a container with a
few properties attached; "navigation_name" and "description."

Essentially, the gist of this is to create a navigation menu with a
<dtml-in> loop that displays all of the Category('s) in a given directory.
However, I want the property "navigation_name" to show up as the hyperlink
text. Does this make sense?

So, if I simply call the <dtml-in "objectValues(['Category'])"> and then
print the name with <dtml-var navigation_name>, everything works fine!!

Here is the proverbial rub. If I want to *test* for the presence of
"navigation_name" so I can print "title_or_id" if it's not defined, Zope
simply skips the "navigation_name" property. It's like it always evaluates
to false!

Example for "left navigation" dtml method:

<dtml-in "objectValues(['Category'])">
 <dtml-if "hasProperty('navigation_name')">
  <dtml-var navigation_name>
<dtml-else>
 <dtml-var title_or_id>
</dtml-if>
</dtml-in>

Okay, I think to myself "self, maybe acquisition is getting in the way," so
I try:

<dtml-in "objectValues(['Category'])">
 <dtml-with sequence-item>
 <dtml-if "hasProperty('navigation_name')">
  <dtml-var navigation_name>
<dtml-else>
 <dtml-var title_or_id>
</dtml-if>
</dtml-with>
</dtml-in>

Doesn't work!

Could this have something to do with the definition of my own Zclass? Do I
have to read into the property sheet specifically? Is there a command for
that?

I took the example from the excellent "Breadcrumb Navigation Trail Howto"
and that works fine, as long as I use a supplied Zope object (like
"folder"). As soon as I use my own ZClasses, this breaks. (I'd like to get
my "navigation_name" into the breadcrumbs as well.

Thanks in advance,
-Darin Lee