[Zope-dev] Display Files from directory

Darshan Preet Singh Manku dpsmanku at indusvalleypartners.com
Mon Mar 15 07:59:54 EST 2004


This is a Zope Newbie here

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!

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!

Also when iterating over the file objects using DTML

<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. 

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!)

thx
Darshan






More information about the Zope-Dev mailing list