[Zope] Display titles of containing folders
Milos Prudek
milos.prudek@tiscali.cz
Mon, 26 Nov 2001 21:15:19 +0100
How can I display titles of folder, its parent folder etc. that contain
a given ZClass if I iterate over a Catalog?
Catalog_Art is a catalog of Articles.
Given the following dtml method I would like to display the "path" to
the article. Path means the titles of folders that the Article instance
is located in:
<table>
<dtml-in Catalog_Art>
<tr><td><dtml-var mypath></td></tr>
</dtml-in>
</table>
mypath is a Python Script that I cannot find a way to create :-( I head
a good start:
fullpath=context.getpath(context.data_record_id)
fullpath=fullpath[1:]
fullpath=string.replace(fullpath,"/",".")
subfolder=fullpath[0:string.rfind(fullpath,".")]
folder=subfolder[0:string.rfind(subfolder,".")]
at this point folder=="folder_a" and subfolder=="folder_a.folder_aa".
But what next? I cannot run folder_title=getattr(folder,"title"),
because getattr does not work that way, and I cannot run eval(), because
it is not allowed in Python Scripts.
--
Milos Prudek