Ulrich Wisser wrote:
> Hello,
> 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". 

Hmmm... try this as a Python (Script|Method|External Method), don't try and do
it in DTML ;-)

object = lfs
for id in path_to_handle:
        object = object.get(id)
return object.fileids

you could probably turn that into a one liner with reduce:

return reduce(lamda x,y: x.get(y), [lfs]+path_to_handle).fileids

I'd laugh loads if you could do that in DTML:

<dtml-var "reduce(lamda x,y: x.get(y), path_to_handle, lfs).fileids">

Who said you can't write obfuscated python?



PS: The first method should work, the one may work through sheer fluke, neither
have been tested though...

PPS: Nice to see someone using PathHandler :-)

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to