Changes between Initial Version and Version 1 of Ticket #15353


Ignore:
Timestamp:
Feb 20, 2011, 6:00:36 PM (14 years ago)
Author:
Russell Keith-Magee
Comment:

Please use preview when submitting code samples.

As for the bug itself: response *always* has a 'content' attribute. That's part of the basic contract of HttpResponse. The static serve view works fine for me with binary content -- because it doesn't just dump a file, it constructs a HttpResponse to contain the file content. I can't reproduce the problem as described, and what you're describing doesn't make a whole lot of sense.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #15353

    • Property Resolutionworksforme
    • Property Status newclosed
  • Ticket #15353 – Description

    initial v1  
    11In django.middleware.gzip.GZipMiddleware have a bug:
    2 
     2{{{
    33def process_response(self, request, response):
    44        # It's not worth compressing non-OK or really short responses.
    55        if response.status_code != 200 or len(response.content) < 200:
    66            return response
    7 
     7}}}
    88exist response without response.content!
    99
    1010when I use: (in url.py )
     11{{{
    1112(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
    12 
     13}}}
    1314to binary files have a problem, do not exist response.content.
    14 
     15{{{
    1516to solver the bug I add 'try' on code:
    1617       try:
     
    1920       except:
    2021        return response
    21 
     22}}}
    2223In my vision the middlewere gzip don't have compress binary, because the browser is incompatible
    2324
Back to Top