jazzband / django-downloadview

Serve files with Django.
https://django-downloadview.readthedocs.io
Other
374 stars 57 forks source link

Forward BaseDownloadView.get() args and kwargs to render_to_response() #109

Closed rleonhardt closed 4 years ago

rleonhardt commented 9 years ago

BaseDownloadView.get() should forward _args, *_kwargs to render_to_response() to allow overriding default values like content_type in DownloadResponse.__init__().

In addition, binary mime types like application/pdf should not contain a charset attribute in DownloadResponse.get_content_type(). Unfortunately the used mimetypes module from the standard library does not offer a text/binary differentiation, and a text/ prefix would not be sufficient, application/javascript is text for example.

rleonhardt commented 9 years ago

Oh, all the mocks forward args and kwargs unkown in DownloadResponse.__init__(), sorry. Maybe an additional **kwargs would solve that, have to test it...

rleonhardt commented 9 years ago

Updated BaseDownloadViewTestCase to not use dummy args/kwargs but kwargs which BaseDownloadView.get() actually forwards to DownloadResponse.__init__().

rleonhardt commented 9 years ago

Now I have catched all locations which used/forwarded response_kwargs to DownloadResponse.__init__() or django.http.HttpResponseBase.__init__(), tests are green, please review, if this change is useful to you.