Commit d087fba3 authored by Kirill Smelkov's avatar Kirill Smelkov

BigFile: Fix most errors reported by pyflakes

    $ pyflakes product/ERP5/Document/BigFile.py

    product/ERP5/Document/BigFile.py:27: 'getToolByName' imported but unused
    product/ERP5/Document/BigFile.py:180: undefined name 'DateTime'
    product/ERP5/Document/BigFile.py:325: local variable 'filename' is assigned to but never used
    product/ERP5/Document/BigFile.py:360: local variable 'data' is assigned to but never used

getToolByName is not used. For DateTime we add appropriate import. data
was there unused from the beginning - from 00f696ee (Allow to upload in
chunk.) - for query_range we just return range = [0, current_size-1] and
data is left unused.

I did not remove filename in

    # need to return it as attachment
    filename = self.getStandardFilename(format=format)
    RESPONSE.setHeader('Cache-Control', 'Private') # workaround for Internet Explorer's bug
    RESPONSE.setHeader('Accept-Ranges', 'bytes')

because as the comment says it tries to workaround some IE bug and I
have no clue is filename needed in that case and was forgotten to be
appended or it is the other way.
Reviewed-by: Romain Courteaud's avatarRomain Courteaud <romain@nexedi.com>
parent f126d0bf
......@@ -24,8 +24,8 @@ from ZPublisher.HTTPRequest import FileUpload
from ZPublisher import HTTPRangeSupport
from webdav.common import rfc1123_date
from mimetools import choose_boundary
from Products.CMFCore.utils import getToolByName, _setCacheHeaders,\
_ViewEmulator
from Products.CMFCore.utils import _setCacheHeaders, _ViewEmulator
from DateTime import DateTime
import re
class BigFile(File):
......@@ -353,8 +353,6 @@ class BigFile(File):
'(?P<last_byte>[0-9]+)/' \
'(?P<total_content_length>[0-9]+)')
if query_range.match(content_range):
data = self._baseGetData()
RESPONSE.setHeader('X-Explanation', 'Resume incomplete')
RESPONSE.setHeader('Range', 'bytes 0-%s' % (current_size-1))
RESPONSE.setStatus(308)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment