Hello, 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')) Btw: i tried the most current LocalFS from CVS, too It "worked" even with the objectValues method. But the big problem is that its very very slow. It took *several minutes* to show a folder in ZMI with about 50 pictures (about 100 kB each) in it; during this the cpu load is eaten completeley by python threads. Really thanks in advance, Oli Keller -- "What're quantum mechanics?" "I don't know. People who repair quantums I suppose." --Terry Pratchett, "Eric"
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. Dieter
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"
Oliver Keller wrote at 2003-2-21 01:13 +0100:
.... 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: What happened? Which exception? Which effect? LocalFS tries to map the file systems object (folders and files) onto Zope objects. You can than use these Zope objects in the same way as you do usually. You can use "DocFinder" <http://www.dieter.handshake.de/pyprojects/zope> to find out about the methods Zope objects support. Dieter
participants (2)
-
Dieter Maurer -
Oliver Keller