[Zope] Accessing file contents (LocalFS)

Mark Snellings msnellings@stellarcomms.com
Wed, 16 Jan 2002 10:54:16 -0500


I've tried the following to access the contents of LocalFS files:

     <dtml-in "test.fileIds()">
         <dtml-var "_['sequence-item'].data">
     </dtml-in>

but I get an the following error:

	Error Type: AttributeError
	Error Value: data

If I use "id" or "mtime" the syntax is correct, but not data.  Any other
suggestions would be appreciated.

Thanks
Mark

-----Original Message-----
From: Max M [mailto:maxm@mxm.dk]
Sent: Wednesday, January 16, 2002 10:41 AM
To: Mark Snellings
Cc: zope@zope.org
Subject: Re: [Zope] Accessing file contents (LocalFS)


Mark Snellings wrote:

> Given a filename, I can access the contents with:
>
> 	<dtml-var "test['foo.txt'].data">
>
> And I can iterate over all the files in the LocalFS with:
>
>     <dtml-in "test.fileIds()">
>         <dtml-var sequence-item>
>     </dtml-in>
>
> 		OR
>
>     <dtml-in "test.fileValues()">
>         <dtml-var id>
>     </dtml-in>
>
> But how do I iterate over all the files in the LocalFS, displaying the
> contents of each file as I go?


you probably only need to combine a few of the things you allready know
(untested)::

     <dtml-in "test.fileIds()">
         <dtml-var "_['sequence-item'].data">
     </dtml-in>

Beware that they are all text files though ;-)

regards Max M