Zope 2.8.0, Python 2.3.5<br>

<br>

I'm having a heck of a time figuring out how to zip up some files in my
zope instance and return them to the user. I can sucessfully create a
zip file on the local file system, but if I try to pass it back to the
user it is corrupted. Of course I'd rather not create this tmp3.zip
file, so if there's a way around that (which I'm sure there is!) please
do let me know.<br>

<br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; filename = 'test.zip'<br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; response = self.REQUEST.RESPONSE<br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; response.setHeader('Content-Type','application/zip')<br>
<div id="mb_0">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; response.setHeader('Content-Disposition','attachment; filename=%s' % filename)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # tried zf =
zipfile.ZipFile( response, 'w' ) but get error, ZHTTP object doesn't
have tell method<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; zf = zipfile.ZipFile( '/tmp3.zip', 'w' )<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; zf.writestr( 'testfilename', str( self._getOb( testfileid ) ) )<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; zf.close()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; f = open('/tmp3.zip')<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return f.read()<br>
<br>
Any thoughts on what fairly obvious thing I'm doing wrong? Thanks!<br><span class="sg">
John</span></div>