mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-04-24 16:44:50 +00:00
PEP-8 fixes
This commit is contained in:
parent
f70eb09d07
commit
5db78ec012
2 changed files with 5 additions and 7 deletions
|
|
@ -1,20 +1,21 @@
|
|||
# Copied from django-sendfile 0.3.6 and tweaked to allow a backend to be passed
|
||||
# to sendfile()
|
||||
# See: https://github.com/johnsensible/django-sendfile/pull/33
|
||||
import os.path
|
||||
from mimetypes import guess_type
|
||||
|
||||
VERSION = (0, 3, 6)
|
||||
__version__ = '.'.join(map(str, VERSION))
|
||||
|
||||
import os.path
|
||||
from mimetypes import guess_type
|
||||
|
||||
|
||||
def _lazy_load(fn):
|
||||
_cached = []
|
||||
|
||||
def _decorated():
|
||||
if not _cached:
|
||||
_cached.append(fn())
|
||||
return _cached[0]
|
||||
|
||||
def clear():
|
||||
while _cached:
|
||||
_cached.pop()
|
||||
|
|
@ -35,7 +36,6 @@ def _get_sendfile():
|
|||
return module.sendfile
|
||||
|
||||
|
||||
|
||||
def sendfile(request, filename, attachment=False, attachment_filename=None, mimetype=None, encoding=None, backend=None):
|
||||
'''
|
||||
create a response to send file using backend configured in SENDFILE_BACKEND
|
||||
|
|
@ -64,7 +64,7 @@ def sendfile(request, filename, attachment=False, attachment_filename=None, mime
|
|||
mimetype = guessed_mimetype
|
||||
else:
|
||||
mimetype = 'application/octet-stream'
|
||||
|
||||
|
||||
response = _sendfile(request, filename, mimetype=mimetype)
|
||||
if attachment:
|
||||
if attachment_filename is None:
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ except ImportError:
|
|||
from email.Utils import parsedate_tz, mktime_tz
|
||||
from wsgiref.util import FileWrapper
|
||||
|
||||
from django.core.files.base import File
|
||||
from django.http import StreamingHttpResponse, HttpResponseNotModified
|
||||
from django.utils.http import http_date
|
||||
|
||||
|
|
@ -60,4 +59,3 @@ def was_modified_since(header=None, mtime=0, size=0):
|
|||
except (AttributeError, ValueError, OverflowError):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue