[Zope] LocalFS and PathHandler

Aleksander Salwa ololo@zeus.polsl.gliwice.pl
Mon, 22 Jan 2001 19:07:57 +0100 (CET)


On Mon, 22 Jan 2001, Ulrich Wisser wrote:

> I try to access LocalFS from my own DTML method.
> (Exactly from my PathHandler method.) I got all
> directory information in one array like this
> 
> path_to_handle = ['sub1', 'sub2', 'sub3']
> 
> How can a get a directory listining with LocalFS
> for path "/sub1/sub2/sub3/"? I know I need something
> like "lfs['sub1']['sub2']['sub3'].fileids". But
> what if there are more (or less) elements in path_to_handle?

I would write it in python, as a recursive function:

def goo(lfs, path_to_handle):
   if len(path_to_handle)==0:
      return lfs
   else:
      lfs=lfs[path_to_handle[0]]
      path_to_handle=path_to_handle[1:]
      return goo(lfs, path_to_handle)


ololo@zeus.polsl.gliwice.pl, oleks@helper.pl

/--------------------------------------\
| `long long long' is too long for GCC |
\--------------------------------------/