[Zope] Inconsistant behavior (long)

Thomas Guettler zopestoller@thomas-guettler.de
Thu, 11 Apr 2002 12:48:38 +0200


David Mackay wrote:

> I have a DTML object that calls an external method which returns an 
> image.  It works correctly for some images, but not for others.  I am 
> using Zope 2.5.0, python2.1.3 on Linux 2.4.18. I get the following 
> traceback when it doesn't work:
> 
> Zope
> Zope Error
> 
> Zope has encountered an error while publishing this resource.
> 
> Error Type: TypeError
> Error Value: argument 2 must be string or read-only buffer, not 
> ImplicitAcquirerWrapper

I had this kind of error yesterday. The problem is, that
the class Image stores the data in data chunks OR in a string.

Have a look at OFS/Image.py.


I extract the information of a file like this:
                 fd=open(tmp_file, "wb")
                 #Stolen from DocumentLibrary.Document.py
                 if type(file.data) is type(''):
                     print "file.data is string"
                     fd.write(file.data)
                 else:
                     print "file.data are linked pdata objects"
                     data=file.data
                     pos = 0
                     while data is not None:
                         fd.write(data.data)
                         data = data.next
                 fd.close()

thomas