[Zope] dtml-tree question

Laurie Nason laurien@blake.3dem.bioch.bcm.tmc.edu
Mon, 1 Oct 2001 16:51:23 -0500


Hi Ron,
Your problem stems from the fact that sequence-item when used in double
quotes " is interpreted as a python statement, hence sequence minus item.
And because sequence doesn't exist it throws a fit!
What you need to do is to use either a <dtml-let item=sequence-item> around
your code and then reference item not sequence-item, or you can use
_['sequence-item'] which escapes the code and should work.

You might also want to check out the property of your sequence-item called
meta_type - it gives the metatype of the item you are currently looking at
i.e. DTML Document, Folder, etc.

hth

Laurie

-----Original Message-----
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
complaw@hal-pc.org
Sent: Monday, October 01, 2001 4:23 PM
To: zope@zope.org
Subject: [Zope] dtml-tree question


I've hit the documentation, and looked at several examples, but I haven't
found
what is needed.

The following code is an attempt to have a tree tag show the Folders and
DTML
Documents.  However, I want to put a hyperlink only to the DTML Documents
(not
the Folders).

Note, this code does not work...

<P ALIGN="left"><STRONG>Categories and
Clauses:</STRONG>&nbsp;&nbsp;&nbsp;(<A
HREF="<dtml-var URL0>?expand_all=1">expand all</A>, <A HREF="<dtml-var
URL0>?collapse_all=1">collapse all</A>)
    <dtml-tree branches_expr="objectValues(['Folder', 'DTML Document'])"
sort=title skip_unauthorized>
      <dtml-if expr="sequence-item == objectValues('Folder')">
        <IMG SRC="<dtml-var SCRIPT_NAME>/<dtml-var icon>">&nbsp;<dtml-var
title>
      <dtml-if expr="sequence-item == objectValues('DTML Document')">
        <IMG SRC="<dtml-var SCRIPT_NAME>/<dtml-var icon>">&nbsp;<A
HREF="&absoulte_url;"><dtml-var title></A>
      </dtml-if>
    </dtml-tree>
  </P>


Zope is complaining about the user of "sequence".  Is there a way to check
to
see what type of object it is so that the hyperlink is enabled only for
certain
object types?

TIA,

Ron



_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )