Switched away from using JSONify
This commit is contained in:
parent
4fffa1fcba
commit
cda5cdbb44
9 changed files with 26 additions and 29 deletions
|
|
@ -17,7 +17,7 @@ from openflexure_microscope.api.v2.views.captures import capture_schema
|
|||
|
||||
import logging
|
||||
import io
|
||||
from flask import jsonify, request, abort, url_for, redirect, send_file
|
||||
from flask import request, abort, url_for, redirect, send_file
|
||||
|
||||
|
||||
@ThingAction
|
||||
|
|
@ -164,7 +164,7 @@ class GPUPreviewStartAPI(View):
|
|||
microscope.camera.start_preview(fullscreen=fullscreen, window=window)
|
||||
|
||||
# TODO: Make schema for microscope state
|
||||
return jsonify(microscope.state)
|
||||
return microscope.state
|
||||
|
||||
|
||||
@ThingAction
|
||||
|
|
@ -176,4 +176,4 @@ class GPUPreviewStopAPI(View):
|
|||
microscope = find_component("org.openflexure.microscope")
|
||||
microscope.camera.stop_preview()
|
||||
# TODO: Make schema for microscope state
|
||||
return jsonify(microscope.state)
|
||||
return microscope.state
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ from labthings.server import fields
|
|||
|
||||
from openflexure_microscope.utilities import axes_to_array, filter_dict
|
||||
|
||||
from flask import Blueprint, jsonify, request
|
||||
from flask import Blueprint, request
|
||||
|
||||
import logging
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ class MoveStageAPI(View):
|
|||
logging.warning("Unable to move. No stage found.")
|
||||
|
||||
# TODO: Make schema for microscope state
|
||||
return jsonify(microscope.state["stage"]["position"])
|
||||
return microscope.state["stage"]["position"]
|
||||
|
||||
|
||||
@ThingAction
|
||||
|
|
@ -67,4 +67,4 @@ class ZeroStageAPI(View):
|
|||
microscope.stage.zero_position()
|
||||
|
||||
# TODO: Make schema for microscope state
|
||||
return jsonify(microscope.state["stage"])
|
||||
return microscope.state["stage"]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import logging
|
||||
from flask import abort, request, redirect, url_for, send_file, jsonify
|
||||
from flask import abort, request, redirect, url_for, send_file
|
||||
|
||||
from openflexure_microscope.api.utilities import get_bool, JsonResponse
|
||||
|
||||
|
|
@ -185,7 +185,7 @@ class CaptureTags(View):
|
|||
if not capture_obj:
|
||||
return abort(404) # 404 Not Found
|
||||
|
||||
return jsonify(capture_obj.tags)
|
||||
return capture_obj.tags
|
||||
|
||||
def put(self, id):
|
||||
"""
|
||||
|
|
@ -205,7 +205,7 @@ class CaptureTags(View):
|
|||
|
||||
capture_obj.put_tags(data_dict)
|
||||
|
||||
return jsonify(capture_obj.tags)
|
||||
return capture_obj.tags
|
||||
|
||||
def delete(self, id):
|
||||
"""
|
||||
|
|
@ -225,7 +225,7 @@ class CaptureTags(View):
|
|||
for tag in data_dict:
|
||||
capture_obj.delete_tag(str(tag))
|
||||
|
||||
return jsonify(capture_obj.tags)
|
||||
return capture_obj.tags
|
||||
|
||||
|
||||
@Tag("captures")
|
||||
|
|
@ -240,7 +240,7 @@ class CaptureAnnotations(View):
|
|||
if not capture_obj:
|
||||
return abort(404) # 404 Not Found
|
||||
|
||||
return jsonify(capture_obj.annotations)
|
||||
return capture_obj.annotations
|
||||
|
||||
def put(self, id):
|
||||
"""
|
||||
|
|
@ -260,4 +260,4 @@ class CaptureAnnotations(View):
|
|||
|
||||
capture_obj.put_annotations(data_dict)
|
||||
|
||||
return jsonify(capture_obj.annotations)
|
||||
return capture_obj.annotations
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from labthings.server.view import View
|
|||
|
||||
from labthings.server.decorators import ThingProperty, Tag, doc_response
|
||||
|
||||
from flask import jsonify, request, abort
|
||||
from flask import request, abort
|
||||
import logging
|
||||
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ class SettingsProperty(View):
|
|||
Current microscope settings, including camera and stage
|
||||
"""
|
||||
microscope = find_component("org.openflexure.microscope")
|
||||
return jsonify(microscope.read_settings())
|
||||
return microscope.read_settings()
|
||||
|
||||
def put(self):
|
||||
"""
|
||||
|
|
@ -51,7 +51,7 @@ class NestedSettingsProperty(View):
|
|||
except KeyError:
|
||||
return abort(404)
|
||||
|
||||
return jsonify(value)
|
||||
return value
|
||||
|
||||
@doc_response(404, description="Settings key cannot be found")
|
||||
def put(self, route):
|
||||
|
|
@ -78,7 +78,7 @@ class StateProperty(View):
|
|||
Show current read-only state of the microscope
|
||||
"""
|
||||
microscope = find_component("org.openflexure.microscope")
|
||||
return jsonify(microscope.state)
|
||||
return microscope.state
|
||||
|
||||
|
||||
@Tag("properties")
|
||||
|
|
@ -96,7 +96,7 @@ class NestedStateProperty(View):
|
|||
except KeyError:
|
||||
return abort(404)
|
||||
|
||||
return jsonify(value)
|
||||
return value
|
||||
|
||||
|
||||
@ThingProperty
|
||||
|
|
@ -106,7 +106,7 @@ class ConfigurationProperty(View):
|
|||
Show current read-only state of the microscope
|
||||
"""
|
||||
microscope = find_component("org.openflexure.microscope")
|
||||
return jsonify(microscope.configuration)
|
||||
return microscope.configuration
|
||||
|
||||
|
||||
@Tag("properties")
|
||||
|
|
@ -124,4 +124,4 @@ class NestedConfigurationProperty(View):
|
|||
except KeyError:
|
||||
return abort(404)
|
||||
|
||||
return jsonify(value)
|
||||
return value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue