From 750da21749aa65964c900ba3be96ec91e121171f Mon Sep 17 00:00:00 2001 From: assar Date: Sat, 10 Jun 2017 14:25:53 +0200 Subject: [PATCH] More fixes --- server.py | 3 ++- static/script.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/server.py b/server.py index a8e83b4..1f617d2 100644 --- a/server.py +++ b/server.py @@ -98,7 +98,8 @@ def alter(partID): datasheet_file = request.files['datasheet-file'] datasheet_filename = secure_filename(datasheet_file.filename) datasheet_file.save('/srv/datasheets/' + datasheet_filename) - os.remove('/srv/datasheets/' + l[0]['datasheet']) + if l[0]['datasheet'] != None: + os.remove('/srv/datasheets/' + l[0]['datasheet']) else: datasheet_filename = l[0]['datasheet'] s += 'where id=:id;' diff --git a/static/script.js b/static/script.js index 9916154..7c18832 100644 --- a/static/script.js +++ b/static/script.js @@ -203,7 +203,7 @@ function show_part_info(partID) { $('#quantity-info').text(text_filter(data.quantity)); $('#notes-info').text(text_filter(data.notes)); if (data.datasheet != null) - $('#datasheet-info').append($('')); + $('#datasheet-info').html($('')); else $('#datasheet-info').text(' '); $('#edit-button').click(function() {