1 2 3 4 5 6 7 8 | def serve_download(view_func):
def _wrapped_view_func(request, *args, **kwargs):
response = view_func(request, *args, **kwargs)
response['Content-Type'] = 'application/octet-stream';
import os.path
response['Content-Disposition'] = 'attachment; filename="%s"' % os.path.basename(kwargs['path'])
return response
return _wrapped_view_func
|
More like this
- X-Sendfile static file serve view by dokterbob 1 year, 4 months ago
- Fix for GZipMiddleware when serving files or streaming or using iterators by wojtek 2 years, 3 months ago
- Serve from STATIC_ROOT by popen2 8 months, 3 weeks ago
- Serve static media and indexes from app directories [Python2.5, Development only] by adamlofts 3 years, 5 months ago
- Enforce site wide login by chbrown 3 years, 3 months ago
Comments