update Shared

This commit is contained in:
j 2015-11-04 13:01:55 +01:00
commit 6881f3471a
184 changed files with 13080 additions and 13691 deletions

View file

@ -3,7 +3,7 @@
import os
import mimetypes
from datetime import datetime, timedelta
from urllib import quote
from six.moves.urllib.parse import quote
from django.http import HttpResponse, Http404
from django.conf import settings
@ -26,14 +26,14 @@ def HttpFileResponse(path, content_type=None, filename=None):
url = getattr(settings, PREFIX+'_URL', '')
if root and path.startswith(root):
path = url + path[len(root)+1:]
if isinstance(path, unicode):
if not isinstance(path, bytes):
path = path.encode('utf-8')
response['X-Accel-Redirect'] = path
if content_type:
response['Content-Type'] = content_type
elif getattr(settings, 'XSENDFILE', False):
response = HttpResponse()
if isinstance(path, unicode):
if not isinstance(path, bytes):
path = path.encode('utf-8')
response['X-Sendfile'] = path
if content_type:
@ -42,7 +42,7 @@ def HttpFileResponse(path, content_type=None, filename=None):
else:
response = HttpResponse(open(path), content_type=content_type)
if filename:
if isinstance(filename, unicode):
if not isinstance(filename, bytes):
filename = filename.encode('utf-8')
response['Content-Disposition'] = "attachment; filename*=UTF=8''%s" % quote(filename)