[Zope] Newbie question re python script to return proper URL for folder

Ben Chapman benjamin-chapman@utulsa.edu
Mon, 04 Feb 2002 12:07:02 -0600


Hi, all:

We have a set of folders; each folder contains a dtml document 
named "content". At the top level, we have an index_html that 
combines the standard_html_header, content, and standard_html_footer
to produce the finished pages.

Now, we're mass cataloguing these pages and we want to search the 
catalog and return links to **the folder** that contains the content
document, rather than the document itself.

In the results method in the Catalog, I've done this:

 <a href="urltrim?url=&dtml-absolute_url;"><dtml-var title></a>

where urltrim is a python script that looks like this:

--- start script urltrim

##parameters=url
import string
sloc=string.rfind(url, '/')
result=url[:sloc+1]
print context.REQUEST.RESPONSE.redirect(result)

--- end script 

This works; if someone clicks on a link to one of the 
catalogued content objects, they get the folder. However, I'm 
positive that this is Not The Zope Way to achieve this result.

Can anyone show me a more zopish approach to the correct result?

Thanks! Ben
bchapman@utulsa.edu