[Zope] LocalFS in Python script

Oliver Keller oli@deswahnsinnsfettebeute.de
Fri, 21 Feb 2003 01:13:16 +0100


Dieter Maurer schrieb:
> Oliver Keller wrote at 2003-2-20 08:16 +0100:
>  > i searched the net for hours now, and tried tons of adjustments.
>  > But i can't get this working!
>  > 
>  > Im using LocalFS 1.0.0 and want to get a randomly selcted image out of a 
>  > folder.
>  > 
>  > My LocalFS object is called "Photos" and
>  > in a ZTP i call  <img src="Photos/dummy.jpg" tal:replace="structure 
>  > container/Photos/Schule/thumb/getRandom">
>  >
>  > 
>  > in the getRandom Python script i only have
>  > return random.choice(context.fileValues('File'))
> 
> What happens?
> 
> When you report problem, please state exactly in what way is fails.

sorry, i thought i did an obvious mistake.
my real problem is that i can't find any info about ZTP and LocalFS. 
only some basics showing solutions in dtml.
(but i'm new to the template pages and want to stick with it for at 
least this project :)

No, i switched back to LFS from CVS because i plan, in the future, to 
check image properties (height/width).
The problem is the mentioned cpu usage and long wait time.
(if you are curios:
http://www.deswahnsinnsfettebeute.de/abi2002/startseite.html
)

this page invokes like above the getRandom script with the only 
difference that i figured out that only objectValues()(instead of 
fileValues('File')) works. (and this only by trial and error!)

so maybe someone could tell me how the LFS scheme looks for usage in a 
python script. i tried several things like 
context.Photos['Schule']['thumb'] but nothing did the trick.
again i don't give the errors as they are to many different ones and i 
think im missing something really basic.
(wasn't there someway with getObject() or getitem?)

Thanks so far,
oli
-- 
"What're quantum mechanics?"
"I don't know. People who repair quantums I suppose."
                                      --Terry Pratchett, "Eric"