[Zope] Newbie Question - DTML syntax for referencing files with extensions

Gary Speer gspeer@cortech.org
Mon, 11 Nov 2002 12:12:54 -0700


Hi all -
I've been through the books and searched howtos, but can't find the trick.

In short, I'm looking for the sytax to use to reference a file name that has
an extension so that the extension is treated as a continuation of the
filename and not treated as an attribute of a resulting non-existant object
due to truncating the extension.

I am also trying to manage acquisition selectively

To put this is context, my goal is to create a list of links by looping
through folders and their subfolders recursively.
For each folder, if it has an icon to display, display it.  If not list its
title_or_id.
Here is the non-functional code I would like to implement.
dtml method: listuploads (found in the acquisition hierarchy)
<dtml-in expr="uploadedpages.objectValues('Folder')" sort=id>      # loop
through subfolders of current context
<dtml-with id only>
# do not accidentally acquire the pageicon.gif of a parent folder
<a href sequence-var-url>
# make whatever is displayed a link to that folder's index_html
<dtml-if expr="'pageicon.gif'">
# test the existance of a 'pageicon.gif' file in this folder
<dtml-var pageicon.gif>
# if found, display it
<dtml-else>
<dtml-var title_or_id>
# if not found, display folder's title
</dtml-if>
<dtml-if expr="objectValues('Folder')">
# test if the current folder has subfolders
<dtml-var listuploads>
# if so, call this method recursively for the subfolders
</dtml-if>
</a>
</dtml-with>
</dtml-in>

Questions -
1.  Syntax for <dtml-if expr="pageicon.gif">

2.  How to acquire the listuploads method with a 'with only' in effect.  Use
another with pointing to its explicit URL?  Use a path?
like <dtml-var methodlibrary.listuploads> where methodlibrary is a folder
object of the root?

3. Instead of the 'with only', is there a way to limit acquistion of
pageicon.gif from the parent erroneously resulting in true in the if test?

I'm sure this has been addressed before, but I could not find it.  All
suggestions appreciated ...
Thanks,
Gary