Fix for GZipMiddleware when serving files or streaming or using iterators

1
2
3
4
5
6
7
from django.middleware.gzip import GZipMiddleware

class FixedGZipMiddleware(GZipMiddleware):
    def process_response(self, request, response):
        if hasattr(response, 'dontgzip'):
            return response
        return GZipMiddleware.process_response(self, request, response)

More like this

  1. Improved Pickled Object Field by taavi223 3 years, 10 months ago
  2. Gzip decorator by SmileyChris 4 years, 11 months ago
  3. Logging Middleware by Magus 5 years, 8 months ago
  4. XhtmlMortifierMiddleware by jgelens 5 years, 2 months ago
  5. pyText2Pdf - Python script to convert plain text into PDF file. Modified to work with streams. by vsergeyev 3 years, 7 months ago

Comments

(Forgotten your password?)