Commit 9b8396be authored by Adam Caprez's avatar Adam Caprez
Browse files

Make checking of md5 optional

parent 581e9c06
......@@ -229,7 +229,7 @@ class MongoDB(object):
msg = "Experiment with id '%s' does not exist.\n" % (experiment_id,)
return (valid, msg, data)
def fetch_from_gridfs(self, gridfs_id, filename):
def fetch_from_gridfs(self, gridfs_id, filename, checkmd5=True):
"""
:param gridfs_id: GridFS _id of file to get.
:type gridfs_id: bson.objectid.ObjectId
......@@ -256,11 +256,14 @@ class MongoDB(object):
output_fh.close()
gridfs_file.close()
if gridfs_md5 == hash_md5.hexdigest():
return True
if checkmd5:
if gridfs_md5 == hash_md5.hexdigest():
return True
else:
print "MD5 mismatch saving file from GridFS to '%s'" % (filename)
return False
else:
print "MD5 mismatch saving file from GridFS to '%s'" % (filename)
return False
return True
def get_samples(self, experiment_id):
valid = True
......
Supports Markdown
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