5 Mar
2005
5 Mar
'05
6:49 p.m.
Chris wrote at 2005-3-5 00:09 +0100:
... I have an external method to resize an image (see below). I can call the method without a problem from a script within Zope and it does it's job. Hovever, if I call it twice within the same script, I get the error "can not identify image" although the same FileUpload instance is passed.
That's an easy one: "FileUpload" is a file like object. A file has a file pointer associated. When it is read, the file pointer is advanced -- reading thus has a side effect. Almost surely, your first call moved the file pointer to the end and the second one does not find content. You can use the "seek" method to reposition the file pointer. -- Dieter