Fixed printing images from AJAX calls
This commit is contained in:
parent
07e444c3b4
commit
cd663087c8
23
src/main.py
23
src/main.py
@ -122,17 +122,24 @@ def api_print_image():
|
||||
sign = request.form["signature"]
|
||||
except Exception as e:
|
||||
flash(str(e),'error')
|
||||
redirect(url_for('index'))
|
||||
app.logger.error(str(e) + " - Whoops, no forms submitted or missing signature.")
|
||||
return redirect(url_for('index'))
|
||||
|
||||
if request.method == 'POST':
|
||||
# check if the post request has the file part
|
||||
|
||||
if 'img' not in request.files:
|
||||
flash('No file found. Did you use the good form ?', 'error')
|
||||
return redirect(url_for("index"))
|
||||
else:
|
||||
file = request.files['img']
|
||||
|
||||
try:
|
||||
if 'img' not in request.files:
|
||||
flash('No file found. Did you use the good form ?', 'error')
|
||||
app.logger.error("No file found. Did you use the good form ?")
|
||||
return redirect(url_for("index"))
|
||||
else:
|
||||
file = request.files['img']
|
||||
except Exception as e:
|
||||
if sign is not None and photo is not None:
|
||||
pass
|
||||
else:
|
||||
flash(str(e), 'error')
|
||||
app.logger.error("Couldn't get an image nor signature : " + str(e))
|
||||
|
||||
# If the user does not select a file, the browser submits an
|
||||
# empty file without a filename.
|
||||
|
Loading…
Reference in New Issue
Block a user