diff --git a/server.py b/server.py index ef45901..3256716 100644 --- a/server.py +++ b/server.py @@ -1,5 +1,6 @@ -import json +import os import re +import json import sqlalchemy from sqlalchemy.sql import select from sqlalchemy.sql import text @@ -97,7 +98,7 @@ def alter(partID): datasheet_file = request.files['datasheet-file'] datasheet_filename = secure_filename(datasheet_file.filename) datasheet_file.save('/srv/datasheets/' + datasheet_filename) - # TODO: Remove old datasheet + os.remove('/srv/datasheets/' + l[0]['datasheet']) else: datasheet_filename = l[0]['datasheet'] s += 'where id=:id;'