[Zope] Import File

Max M maxm@mxm.dk
Mon, 24 Mar 2003 20:06:09 +0100


Sebastian Quei=DFer wrote:

> Is there a function in python like ImageFile() for a normal file, like =

> a pdf?
> If so, can you tell me where I have to import it from.


I think you need to do something like:

import OFS

f =3D open('path/to/file', 'rb')
data =3D f.read()
f.close()
self._setObject(fileID, OFS.Image.Image(fileID,'Laerings graf',''))
self._getOb(fileID).update_data(data)