Correctly deleting existing datasheet

master
Davide Bongiovanni 6 years ago
parent b44d05aabd
commit cc6a1473cb

@ -254,9 +254,9 @@ def alter(partID):
datasheet_file.save('/srv/datasheets/' + datasheet_filename)
datasheet_filename = 'http://elab.kth.se/parts/getfile/' + datasheet_filename
if l[0]['datasheet'] != None:
os.remove('/srv/datasheets/' + l[0]['datasheet'])
# elif request.form.has_key('datasheet-url'):
# datasheet_filename = request.form['datasheet-url']
whole_url = l[0]['datasheet']
actual_filename = whole_url[whole_url.rfind('/') + 1:]
os.remove('/srv/datasheets/' + actual_filename)
else:
try:
datasheet_filename = request.form['datasheet-url']

Loading…
Cancel
Save