Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Commit

Permalink
filedownloadutils: overridable suffix and prefix
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Aage Lavik <jan.age.lavik@cern.ch>
  • Loading branch information
jalavik committed Feb 24, 2016
1 parent 3e091a6 commit df46a8d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions modules/miscutil/lib/filedownloadutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ class InvenioFileCopyError(Exception):


def download_url(url, content_type=None, download_to_file=None,
retry_count=10, timeout=10.0):
retry_count=10, timeout=10.0, suffix=".tmp",
prefix="filedownloadutils_"):
"""
Will download a file from given URL (either local or external) to the
desired path (or generate one if none is given). Local files are copied
Expand Down Expand Up @@ -100,8 +101,8 @@ def download_url(url, content_type=None, download_to_file=None,
@raise InvenioFileDownloadError: raised upon URL/HTTP errors, file errors or wrong format
"""
if not download_to_file:
download_to_file = safe_mkstemp(suffix=".tmp",
prefix="filedownloadutils_")
download_to_file = safe_mkstemp(suffix=suffix,
prefix=prefix)

try:
if is_url_a_local_file(url):
Expand Down

0 comments on commit df46a8d

Please sign in to comment.