Ticket #8034: gzip_middleware_no_images_startswith.diff
File gzip_middleware_no_images_startswith.diff, 665 bytes (added by , 16 years ago) |
---|
-
django/middleware/gzip.py
12 12 on the Accept-Encoding header. 13 13 """ 14 14 def process_response(self, request, response): 15 ctype = response.get('Content-Type', '').lower() 16 if ctype and (ctype.startswith('image') or ctype.startswith('video')): 17 return response 18 15 19 # It's not worth compressing non-OK or really short responses. 16 20 if response.status_code != 200 or len(response.content) < 200: 17 21 return response