[Zope] getting the contents of a zope file object

Justin Olmanson audiotap77004 at hotmail.com
Wed Oct 3 19:22:57 EDT 2007


I have a folder which contains text/html files.

I use a dtml method on a file to display a file's contents using <dtml-var 
"this()">. It works great.

So the user's browser is here:    

What I need is a way to get the contents of file01, file02 & file03 while 
the user remains at the above url.

I've been trying to do this via an [internal] python script. Within the 
dtml_method script i call the python script -passing it the name of the 
folder (folderA) and the name of the current file (file04).

I use the folderA to create a folderObject (not shown) which I use to access 
and iterate through the files therein (line 1). Then I check to make sure 
the current file is not file04 (line 2). Then I append some file-specific 
properties to a list (used to create links and descriptions) (lines 3-5). I 
would also like to append the file contents or a portion of the file 
contents in string form (line 6) but what i have tried has not worked.

line 1:     for obj in folderObj.objectValues('File'):
line 2:          if obj.fileName != file04:
line 3:               r.append([obj.fileName, obj.location])
line 4:               r.append([obj.fileName, obj.date])
line 5:               r.append([obj.fileName, obj.creator])
line 6:               r.append([obj.fileName, obj.??????])




More photos; more messages; more whatever. Windows Live Hotmail - NOW with 
5GB storage. 

More information about the Zope mailing list