diff options
author | Paul Sherwood <paul.sherwood@codethink.co.uk> | 2016-04-21 09:00:26 +0100 |
---|---|---|
committer | Paul Sherwood <paul.sherwood@codethink.co.uk> | 2016-04-21 09:00:26 +0100 |
commit | 6e8f787e60cce7e675179f9056e79f7e1961718a (patch) | |
tree | 6846853f30f8fc33c7443af813e0629a07db2635 | |
parent | 4cf58e6c97f201c82a2d8beb9a1767f10811d4a3 (diff) | |
download | ybd-6e8f787e60cce7e675179f9056e79f7e1961718a.tar.gz |
28792b fix for #205 was incompatible with new bottle versions
-rwxr-xr-x | kbas/__main__.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/kbas/__main__.py b/kbas/__main__.py index 2f401a7..3e14be1 100755 --- a/kbas/__main__.py +++ b/kbas/__main__.py @@ -146,8 +146,15 @@ class KeyedBinaryArtifactServer(object): try: upload = request.files.get('file') artifact = os.path.join(tmpdir, cache_id) - with open(artifact, "w") as f: - f.write(upload.value) + + try: + upload.save(artifact) + except: + # upload.save is only available in recent versions of bottle + # troves (for example) have an older version... hence: + with open(artifact, "w") as f: + f.write(upload.value) + if call(['tar', 'tf', artifact]): app.log('UPLOAD', 'ERROR: not a valid tarfile:', artifact) raise |