[Zope] getting the contents of a zope file object

Stefan Tjarks stefan at tjarks.de
Thu Oct 4 00:14:46 EDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Justin Olmanson wrote:
> Hi,
> 
> 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:   
> http://domain.com/folderA/file04/dtml_method
> 
> 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.??????])
> 

try
	obj.data
or
	obj.PrincipiaSearchSource()
should work in your case as well.

- -stef
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHBGi2wRdcaudH4ncRAhEmAJ9fAAjrQev532u39FISYur80qMkzACgqLcx
P+yUA8S5o4J28Fm3CuVXg38=
=G5XI
-----END PGP SIGNATURE-----


More information about the Zope mailing list