[Twisted-Python] Re: Content Encoding : gzip ?

David Bolen db3l.net at gmail.com
Fri Oct 19 15:00:18 EDT 2007


anurag uniyal <anuraguniyal at yahoo.com> writes:

> Thanks.
>
> So it seems I have to write my own code, there in nothing like I can set some flag.

Not in twisted.web, no.

> So if that is the case shouldn't I just be gzipping and unzipping data write and read to request object.

Right - after all, that's really all my wrapper does (for the
output/write case).  If your application structure lends itself to
processing the encoding more inline with your normal processing,
that's perfectly acceptable too.

You'll still end up having to implement two paths (one for gzip and
one for not) to support clients who don't accept the encoding, so
you'll still probably find it smarter to extract out the compression
for re-use.

In my case, I wanted to support naive, existing Resource
implementations, making the gzip encoding operation a separable
activity to the response data generation, so I went with the wrapper
approach.

-- David





More information about the Twisted-Python mailing list