[Zope-dev] Display Files from directory
Chris Withers
lists at simplistix.co.uk
Tue Mar 16 04:35:09 EST 2004
Darshan Preet Singh Manku wrote:
> This is a Zope Newbie here
Then you should be using the zope at zope.org list, zope-dev at zope.org is for the
development OF zope, not the development of applications WITH it.
> When I am trying to pick up files from a Windows directory structure
> (C:\tmp), the code seems to always return me the error BadRequest!
Look at LocalFS or ExtFile...
Exception type, value and traceback from the error_log object would be handy in
any case...
> This is saved as a code in the Extensions folder as
> getDirectoryFiles.py
>
> file = 'C:\tmp'
> def readFile(file=file):
> fd = open(file, 'r')
> lines=fd.readlines()
> fd.close()
> return lines
>
> Is there some problem with the first line : file = 'C:\tmp"?? I have
> tried all kinds of permutations!
well, does C:\tmp exists? Sounds like it might be a folder, which wouldn't work.
> Also when iterating over the file objects using DTML
Might be best to stick to one problem per email...
> <dtml-in expr="objectValues(['File','Folder'])">
> <li><a href = "&dtml-absolute_url;">
> <dtml-var title_or_id></a></li>
> </dtml-in>
>
> I get a listing of all the folders + files which have been created using
> the ZMI.
Yes, what else would you expect?
> Now I want Zope to pick up files and folders from C:\tmp and display all
> the contents as direct URL's!. Problem is the above code picks up only
> those files which are created explicitly by the ZMI (which are a part of
> Zopes' custom database and are not directly accessible!)
The LocalFS product is what you're after...
Chris
--
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
More information about the Zope-Dev
mailing list