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. Decorator to make files downloadable by prigun 3 years, 3 months ago
  2. XhtmlMortifierMiddleware by jgelens 3 years, 10 months ago
  3. Gzip decorator by SmileyChris 3 years, 6 months ago
  4. pyText2Pdf - Python script to convert plain text into PDF file. Modified to work with streams. by vsergeyev 2 years, 3 months ago
  5. GzipFileSystemStorage by dcwatson 2 years, 4 months ago

Comments

(Forgotten your password?)