Skip to main content

WSGI middleware providing gzip compression for HTTP server output.

Project description

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

Releases

0.1 (2007/04/12)

Initial release.

Detailed Documentation

zif.gzipper

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.

Dependencies

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

zope.paste is available at http://svn.zope.org/zope.paste/trunk/

cd [path.to.zope3.src.directory]/zope
svn co http://svn.zope.org/zope.paste/trunk/ paste

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

Instructions for zope.paste are at http://awkly.org/2006/01/25/zopepaste-wsgi-applications-in-zope-3-using-pastedeploy/

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

sudo easy_install.py PasteDeploy

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

Setup

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:Paste.Main]
pipeline = gzipper jsmin main

[app:main]
paste.app_factory = zope.paste.application:zope_publisher_app_factory

[filter:gzipper]
paste.filter_factory=zif.gzipper.gzipper:filter_factory
compress_level=6
exclude=localimages
nocompress=jp gz zip png
tempfile=1048576

[filter:jsmin]
paste.filter_factory=zif.jsmin.jsmin:filter_factory
compress_level=safe

Configuration

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).

Download

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zif.gzipper-0.1.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

zif.gzipper-0.1-py2.4.egg (15.8 kB view details)

Uploaded Source

File details

Details for the file zif.gzipper-0.1.tar.gz.

File metadata

  • Download URL: zif.gzipper-0.1.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for zif.gzipper-0.1.tar.gz
Algorithm Hash digest
SHA256 508efc650e433752e6abb1f3cccd03661d45bd54c4fbefe6e6a252407973a1fe
MD5 cac5efd4da2474afab2839ea7e281629
BLAKE2b-256 3a02736e9ea41724d11fc96f60a6923839b1e14c42d77b7c7c1665de61b7cfc3

See more details on using hashes here.

File details

Details for the file zif.gzipper-0.1-py2.4.egg.

File metadata

File hashes

Hashes for zif.gzipper-0.1-py2.4.egg
Algorithm Hash digest
SHA256 e303be6c8d2b9d7786f6cf69ab3fb80b725f958b0b70c62cbfa11fd503065d6d
MD5 ce61af38a1ee7f8e653ecca174c15f04
BLAKE2b-256 c6f2cf63f3b2a317335221b3c03efd55c1037989df1a6fcf7be8eb09bd33a058

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page