[Zope] zlib (zip a file)

Tino Wildenhain tino@wildenhain.de
Tue, 10 Jul 2001 20:42:09 +0200


Hi Belen,

first you might want to use the zipfile module.
Second, from what I know at least IE does not
handle multipart documents. And as such, you have
to give a mime type for each part. And compressed
pages are obviously not text/html but rather
application/x-zip or something like that.
Sorry for not beeing more specific here, but
I dont have the time for more research now.
Hope you get the right direction.
Either use a single document, so you have to set
headers directly or you might look at the mime
module. If its dtml you want to compress, you
have to call it to render: document(_,_.None)
(iirc)

HTH
Tino Wildenhain

--On Dienstag, 10. Juli 2001 16:22 +0100 belen@netcom.no wrote:

> Hi again,
>
> Thanks for your help. What I intend to do is to compress a set of
> pages, download them all together and decompress them after having
> downloaded it. (The download bit is done)
>
> Having had a look to the documentation I wonder how can I pass several
> pages and compress them as a whole. And which is the right method to
> compress them to have them in a propper format that allows them to be
> decompressed after being downloaded.
>
> I have tried to do it for one page...but zope seems to laugh at me...:(
>
> The method I have used is:
> import zlib
> def compress_data(data):
> 	x = zlib.compress(data,6)
>
>
> To return :
>
> <dtml-call "REQUEST.RESPONSE.setHeader('content-type','text/html')">
> <dtml-call "REQUEST.RESPONSE.setHeader('Content-
> Disposition','Attachment; Filename='+document+'.html')">
> <dtml-return "compress_data(_['document'])">
>
> Has anyone done something like this before? I would be really grateful
> if someone could help me.
>
> Thaks again
>
> belen
>
> ----- Original Message -----
> From: "Andreas Jung" <andreas@andreas-jung.com>
> Date: Tuesday, July 10, 2001 2:47 pm
> Subject: Re: [Zope] zlib
>
>> http://www.python.org/doc/current/lib/module-zlib.html
>>
>> > From: <belen@netcom.no>
>> > Subject: [Zope] zlib
>> > Hello there,
>> >
>> > Has anyone used this module before (zlib)? Can anyone show me an
>> > example of how to use it? I have REALLY tried to search for it
>> but
>> > nothing comes out.
>>
>>
>>
>