summaryrefslogtreecommitdiff
path: root/paste/gzipper.py
diff options
context:
space:
mode:
authorianb <devnull@localhost>2006-10-20 18:36:46 +0000
committerianb <devnull@localhost>2006-10-20 18:36:46 +0000
commit315957c3dd7a71957a15b4fa2048601247ecae83 (patch)
tree9b119369e9b82c9d4889047077a001d19a978b18 /paste/gzipper.py
parent9366c845452889ccd5a09f85c6a3a0c51695a44d (diff)
downloadpaste-315957c3dd7a71957a15b4fa2048601247ecae83.tar.gz
Moved and fixed gzip middleware entry point; typo in docs
Diffstat (limited to 'paste/gzipper.py')
-rw-r--r--paste/gzipper.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/paste/gzipper.py b/paste/gzipper.py
index 2b01c5c..5ec2efe 100644
--- a/paste/gzipper.py
+++ b/paste/gzipper.py
@@ -84,6 +84,19 @@ class GzipResponse(object):
app_iter.close()
def filter_factory(application, **conf):
+ import warnings
+ warnings.warn(
+ 'This function is deprecated; use make_gzip_middleware instead',
+ DeprecationWarning, 2)
def filter(application):
return middleware(application)
return filter
+
+def make_gzip_middleware(app, global_conf, compress_level=6):
+ """
+ Wrap the middleware, so that it applies gzipping to a response
+ when it is supported by the browser and the content is of
+ type ``text/*`` or ``application/*``
+ """
+ compress_level = int(compress_level)
+ return middleware(app, compress_level=compress_level)