ortograph

This commit is contained in:
nemunaire 2017-11-09 00:37:53 +01:00
parent 626353a02d
commit e02dc2169d

View File

@ -49,7 +49,7 @@ def hash_archive(cnt, dest=None, imposed_hash=None):
sha = hashlib.sha1(data.encode() if isinstance(data, str) else data).hexdigest() sha = hashlib.sha1(data.encode() if isinstance(data, str) else data).hexdigest()
yield MailTest("Your tarball SHA-1 is %s." % sha, -1) yield MailTest("Your tarball SHA-1 is %s." % sha, -1)
if dest is not None and os.path.exists(os.path.join(dest, login + "." + sha)): if dest is not None and os.path.exists(os.path.join(dest, login + "." + sha)):
yield MailTest("You have already uploaded this tarball.", 1) yield MailTest("You already have uploaded this tarball.", 1)
yield False yield False
elif imposed_hash is not None and imposed_hash != sha: elif imposed_hash is not None and imposed_hash != sha:
yield MailTest("This is not the expected hash. Your tarball's hash must be: %s." % imposed_hash, 1) yield MailTest("This is not the expected hash. Your tarball's hash must be: %s." % imposed_hash, 1)
@ -92,7 +92,7 @@ def extract(cnt, dest=None):
ldest = os.path.join(dest, login) ldest = os.path.join(dest, login)
dest = os.path.join(dest, login + "." + sha) dest = os.path.join(dest, login + "." + sha)
if os.path.exists(dest): if os.path.exists(dest):
yield MailTest("You have already uploaded this tarball.", 1) yield MailTest("You already have uploaded this tarball.", 1)
return return
last_dest = os.readlink(ldest) if os.path.exists(ldest) else None last_dest = os.readlink(ldest) if os.path.exists(ldest) else None