skip to navigation
skip to content

zif.gzipper 0.2

WSGI middleware providing gzip compression for HTTP server output.

Don’t use this. It does not really play nice in a WSGI stack. To gzip output, put your WSGI stack behind a proxy that gzips, e.g., nginx or apache.

If you just want to amuse yourself, feel free to play with this. I could remove the package completely, but what the heck…

See ‘src/zif/gzipper/README.txt’ for more information.


0.2 (2007/04/13)

Small improvements to documentation files.

0.1 (2007/04/12)

Initial release.

Detailed Documentation


This is a wsgi middleware application intended for use with paste.deploy, zope.paste, and zope3.

It serves as a wsgi filter to gzip output from a zope3 application.


for zope3, zif.gzipper requires Sidnei da Silva’s zope.paste

zope.paste is available at

cd []/zope
svn co paste

zope.paste is also available at the python cheese shop.

Instructions for zope.paste are at

zope.paste requires paste.deploy. paste.deploy may be obtained from the cheese shop. Presuming you have setuptools installed,

sudo PasteDeploy

This (zif.gzipper) package can be unzipped and installed anywhere on the Python path.


Follow Sidnei’s instructions for setting up zope.paste. It involves putting the usual zope.paste-configure.zcml file in [zope3 instance]/etc/site-packages. There is also a parameter to change in [zope3 instance]/etc/zope.conf. The new twist is a paste.ini file in [zope3 instance]/etc

My paste.ini file looks like:

pipeline = gzipper jsmin main

paste.app_factory = zope.paste.application:zope_publisher_app_factory

nocompress=jp gz zip png



gzipper should be the first filter in the pipeline. Other filters will have a hard time reading compressed data output from this filter.

The paste.ini file above shows examples of the configuration options for gzipper.

  • compress_level is the level of compression for the gzip function. 6 is the default. 9 is max. 3 is often good enough. Higher numbers use more processor, but compress smaller.
  • exclude is a sequence of strings that appear in the a filename or path you wish to exclude from gzipping. If any of these strings appears in the path or filename, gzipper will not gzip the file.
  • nocompress is a sequence of strings that appear in content-types you wish to exclude from gzipping. If the string appears anywhere in the content-type, items with that content-type will not be gzipped. “jp” will exclude “image/jpg” and “image/jpeg”. “application” will exclude any content-type with the word “application” in it.
  • tempfile is the file size above which gzipper will send the gzipped data to a tempfile on disk. This may help memory usage. It may not. tempfile=0 means do not use temporary file. Default is 1 megabyte (1048576).


File Type Py Version Uploaded on Size
zif.gzipper-0.2-py2.4.egg (md5) Python Egg 2.4 2007-04-13 15KB
zif.gzipper-0.2.tar.gz (md5) Source 2007-04-13 7KB