Problem with parameter submission to Python Scripts
Hi, I'm trying to get the following script to work in zope: for image in context.objectValues('Image'): if not image.hasProperty('original_id'): context.outputdir.makeThumbnail(image.getId()) Where outputdir is a parameter passed to script, and is called with makeThumbnails?outputdir=thumbnail where thumbnail is a folder in Zope. The problem is: context.outputdir.makeThumbnail(image.getId()) I need the object that is refered to by outputdir. For instance if I use: context.thumbnail.makeThumbnail(image.getId()) it works fine. I've tried getattr, getitem, but had no luck. Can anyone shed light on the correct way to do it? Thanks Regards Mark Simpson
<snip>
The problem is: context.outputdir.makeThumbnail(image.getId())
I need the object that is refered to by outputdir.
For instance if I use: context.thumbnail.makeThumbnail(image.getId()) it works fine.
I've tried getattr, getitem, but had no luck.
Did you try... getattr(context, outputdir).makeThumbnail(image.getId()) I don't know if that's right, but it's what I would try. tim
Hi Mark! had a simmilar problem a few days ago: outputdir=context.REQUEST['outputdir'] context[outputdir]makeThumbnail (image.getId()) worked for me! good luck markus On Thu, 10 Jan 2002, Mark Simpson wrote:
Hi,
I'm trying to get the following script to work in zope:
for image in context.objectValues('Image'): if not image.hasProperty('original_id'): context.outputdir.makeThumbnail(image.getId())
Where outputdir is a parameter passed to script, and is called with
makeThumbnails?outputdir=thumbnail
where thumbnail is a folder in Zope.
The problem is: context.outputdir.makeThumbnail(image.getId())
I need the object that is refered to by outputdir.
For instance if I use: context.thumbnail.makeThumbnail(image.getId()) it works fine.
I've tried getattr, getitem, but had no luck.
Can anyone shed light on the correct way to do it?
Thanks Regards Mark Simpson
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
On Thu, Jan 10, 2002 at 11:30:04PM +0100, Markus Gapp wrote:
outputdir=context.REQUEST['outputdir'] context[outputdir]makeThumbnail (image.getId())
Don't forget a dot: context[outputdir].makeThumbnail (image.getId()) ^ Oleg. -- Oleg Broytmann http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
participants (4)
-
Mark Simpson -
Markus Gapp -
Oleg Broytmann -
Tim Hicks