summaryrefslogtreecommitdiff
path: root/kbas
diff options
context:
space:
mode:
authorPaul Sherwood <paul.sherwood@codethink.co.uk>2016-04-21 09:00:26 +0100
committerPaul Sherwood <paul.sherwood@codethink.co.uk>2016-04-21 09:00:26 +0100
commit6e8f787e60cce7e675179f9056e79f7e1961718a (patch)
tree6846853f30f8fc33c7443af813e0629a07db2635 /kbas
parent4cf58e6c97f201c82a2d8beb9a1767f10811d4a3 (diff)
downloadybd-6e8f787e60cce7e675179f9056e79f7e1961718a.tar.gz
28792b fix for #205 was incompatible with new bottle versions
Diffstat (limited to 'kbas')
-rwxr-xr-xkbas/__main__.py11
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