Commit b61b7177 authored by rgaudin's avatar rgaudin
Browse files

allow retrieval of files without checksum

parent 4ce1e8a7
......@@ -43,7 +43,7 @@ class RequestedFile(object):
return rf
@classmethod
def from_disk(cls, url, fpath, checksum):
def from_disk(cls, url, fpath, checksum=None):
rf = cls(url, fpath)
rf.checksum = checksum
rf.set(cls.FOUND)
......@@ -75,7 +75,8 @@ class RequestedFile(object):
@property
def verified(self):
return self.present and get_checksum(self.fpath) == self.checksum
return self.present and (
get_checksum(self.fpath) == self.checksum or self.checksum == None)
def stream(url, write_to=None, callback=None, block_size=1024):
......@@ -144,6 +145,8 @@ def download_if_missing(url, fpath, logger, checksum=None):
logger.std("MATCH.")
return RequestedFile.from_disk(url, fpath, checksum)
logger.std("MISMATCH.")
elif os.path.exists(fpath):
return RequestedFile.from_disk(url, fpath)
return download_file(url, fpath, logger, checksum)
......
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