[Zope] problem.

Tom Deprez Tom Deprez" <tom.deprez@uz.kuleuven.ac.be
Tue, 16 Oct 2001 17:18:51 +0200


Hi,

I'm propably overlooking something, but I'm facing here a problem which I
can't solve right now. Perhaps somebody knows the solution. I'm creating =
a
zip file and then return that one to the browser so that the user can
download it. The problem is that the created file turns out to be corrupt=
 ie
the data is altered. You can see this below, where I show you the file wh=
ich
I zip and then the file after unzipping the downloaded file. Does somebod=
y
has an idea? I've also problems with PDF files and I'm starting to believ=
e
that this is the same problem.
I'm running zope 2.4.1 on a windows nt machine
Thanks in advance.

Before Zip:

***  Installation Started 04/05/00 21:48  ***
Title: Zope Installation
Source: C:\Zope\program\Zope-2.1.6-win32-x86.exe
Installation Aborted!
User Rights: Admin
***  Installation Started 07/17/00 11:01  ***
Title: Zope Installation
Source: E:\Internet\download\Zope-2_2_0-win32-x86.exe
Installation Aborted!
User Rights: Admin

After Zip:

***  Installation Started 04/05/00 21:48  ***
Title: Zope Installation
Source: C:\Zope\program\Zope-2.1.6-win32-x86.exe
Installation Aborted!
User Rights: Admin
***  Installation Started 07/17/00 11:01  ***
Title: Zope Installation
Source: E:\Internet\download\Zope-2_2_0-win32-x86.exe
Installation Aborted!
User Rights: Admin
=D83=C9sQ=01  Q=01

If I look in a  textfile the above returns etc were also transformed.

Used code:

import zipfile
import tempfile

def zipfolder(self):
    filename=3Dtempfile.mktemp()+'.zip'
    zip=3Dzipfile.ZipFile(filename,'w',zipfile.ZIP_STORED)
    zip.write('c:\install.log')
    zip.close()
    return open(filename).read()

and method calling above code:

<dtml-call "REQUEST.set('Content-type','application/zip;')">
<dtml-return expr=3D"testzip()">