#15353: problem with django.middleware.gzip.GZipMiddleware
------------------------------+---------------------------------------------
 Reporter:  bispo@…           |          Owner:  nobody    
   Status:  new               |      Milestone:            
Component:  Django Web site   |        Version:  1.2       
 Keywords:  middleware gzip   |   Triage Stage:  Unreviewed
Has patch:  1                 |  
------------------------------+---------------------------------------------
 In django.middleware.gzip.GZipMiddleware have a bug:

 def process_response(self, request, response):
         # It's not worth compressing non-OK or really short responses.
         if response.status_code != 200 or len(response.content) < 200:
             return response

 exist response without response.content!

 when I use: (in url.py )
 (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root':
 settings.MEDIA_ROOT}),

 to binary files have a problem, do not exist response.content.

 to solver the bug I add 'try' on code:
        try:
         if response.status_code != 200 or len(response.content) < 200:
             return response
        except:
         return response

 In my vision the middlewere gzip don't have compress binary, because the
 browser is incompatible

-- 
Ticket URL: <http://code.djangoproject.com/ticket/15353>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to