Correctly deleting existing datasheet

pull/3/head
Davide Bongiovanni 6 years ago
parent b44d05aabd
commit cc6a1473cb

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

Loading…
Cancel
Save