#24158: Static serve failure since 1.4.18
-------------------------------+-------------------------
Reporter: TheRealEckat | Owner: nobody
Type: Uncategorized | Status: new
Component: Generic views | Version: 1.4
Severity: Normal | Keywords: development
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+-------------------------
With version 1.4.18 a change modified django.views.static.serve at line 65
for reading the file.
HttpResponse is called with the iter object, but this can't do anything
with that.
From Django 1.5 the CompatibleStreamingHttpResponse is used at this point.
Reproducible by adding
{{{
if settings.DEBUG:
urlpatterns += patterns('',
url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
'document_root': settings.MEDIA_ROOT,
}),
)
}}}
to the urls.py an call a file in that path.
The Response status is 200 and the content lenght is transmitted
correctly.
In fact, only 0 bytes transferred.
A possible fix is, to change the line to
{{{
response = HttpResponse(''.join(iter(lambda:
f.read(STREAM_CHUNK_SIZE), '')), mimetype=mimetype)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24158>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/055.a4540a90e928e5db03d3df60db988241%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.