[Zope] Python external method

Laurie Nason laurien@tiger.bcm.tmc.edu
Mon, 21 May 2001 15:32:05 -0500


Hi guys,
I have a very simple python external function (id=thumbnail, module=thumb,
function=thumbnail)

####!/usr/bin/python

def thumbnail(infile,size):

	try:
	    im = infile
	except IOError:
	    print "cannot create thumbnail for", infile

	im2=im.thumbnail((size,size))

	return im2

All this does is to take a file object and return the thumbnail of the image
provided - fairly simple I hear you say - well, I can't seem to get the dtml
required to call it. I want the form to display just a thumbnail of the full
image so I pass in the id of the image object - I have tried most
combinations including the ones below:

<dtml-var expr="thumbnail(_['id'],128)">   Error---"not enough arguments;
expected 2, got 1 "

<dtml-var expr="thumbnail(_.getattr(REQUEST,'id'),128)">
<dtml-var expr="thumbnail(_[_.getattr(REQUEST,'id')],128)">
<dtml-var expr="thumbnail(_.getitem(_['id']),128)">


WHY????????? &:-(

Laurie

Laurie Nason
Dept. of Biochemistry - N420
Baylor College of Medicine
Houston. TX77030