Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix strange bug when SpooledTemporaryFile seems to be not seekable on… #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions publisher/worker/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,16 @@ def collect(self, url, working_dir):

def _downloadData(self, url):
"""
Downloads the related content/data from the publisher instance and
stores it in memory.
Downloads the related content/data from the publisher instance

Returns the file object of the download file
"""
logger.debug("Downloading file from: %s" % url)
with self._open_url(url) as url_file:
mem_puffer = tempfile.SpooledTemporaryFile()
mem_puffer.write(url_file.read())
mem_puffer.seek(0)
return mem_puffer
temp_file = tempfile.TemporaryFile()
temp_file.write(url_file.read())
temp_file.seek(0)
return temp_file

def _validateData(self, zdata):
"""
Expand Down