diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2021-04-01 15:31:52 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2021-04-01 15:31:52 +0200 |
| commit | 5cafa9d43b769e6f60740f59293ddf3588e7b8ad (patch) | |
| tree | a3d378cfbb91bec5c549e187e177a1fc327ef1fb /cli/app/controllers/upload_controller.py | |
| parent | 8c733583739517ff453d561f3b8fc5ca0d334819 (diff) | |
migration: add settings to uploads. cursor upload
Diffstat (limited to 'cli/app/controllers/upload_controller.py')
| -rw-r--r-- | cli/app/controllers/upload_controller.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/cli/app/controllers/upload_controller.py b/cli/app/controllers/upload_controller.py index 94a7fd1..022b08a 100644 --- a/cli/app/controllers/upload_controller.py +++ b/cli/app/controllers/upload_controller.py @@ -5,6 +5,7 @@ from werkzeug.utils import secure_filename import os import numpy as np from PIL import Image +import json from app.settings import app_cfg from app.sql.common import db, Session @@ -70,6 +71,14 @@ class UploadView(FlaskView): except: raise APIError('No graph_id specified') + try: + settings = request.form.get('settings') + settings = json.loads(settings) + # print(graph_id) + except: + settings = {} + + if 'image' in request.files: file = request.files['image'] # print(fn) @@ -113,7 +122,7 @@ class UploadView(FlaskView): os.makedirs(uploaded_im_abspath, exist_ok=True) file.save(uploaded_im_fullpath) - upload = Upload(username=username, tag=tag, fn=uploaded_im_fn, sha256=sha256, ext=ext, graph_id=graph_id) + upload = Upload(username=username, tag=tag, fn=uploaded_im_fn, sha256=sha256, ext=ext, graph_id=graph_id, settings=settings) session.add(upload) session.commit() response = { |
