Added file removal when substituting datasheet

pull/3/head
Davide Bongiovanni 8 years ago
parent 42d4d56cf1
commit 97226674e7

@ -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;'

Loading…
Cancel
Save