Moved API views up a level

This commit is contained in:
Joel Collins 2019-11-13 14:06:41 +00:00
parent e76dee2383
commit bb9bb77536
14 changed files with 15 additions and 16 deletions

View file

@ -1,5 +1,5 @@
from openflexure_microscope.api.utilities import gen, JsonResponse
from openflexure_microscope.api.v1.views import MicroscopeView
from openflexure_microscope.api.views import MicroscopeView
from flask import Response, Blueprint, jsonify, request
import logging

View file

@ -1,5 +1,3 @@
from openflexure_microscope.api.v1.views import MicroscopeView
from flask import Blueprint
from . import capture, record, preview, function

View file

@ -1,8 +1,8 @@
from openflexure_microscope.api.utilities import get_bool, JsonResponse
from openflexure_microscope.api.v1.views import MicroscopeView
from openflexure_microscope.api.views import MicroscopeView
from openflexure_microscope.utilities import filter_dict
from flask import Response, jsonify, request, abort, url_for, redirect, send_file
from flask import jsonify, request, abort, url_for, redirect, send_file
class ListAPI(MicroscopeView):

View file

@ -1,4 +1,4 @@
from openflexure_microscope.api.v1.views import MicroscopeView
from openflexure_microscope.api.views import MicroscopeView
from openflexure_microscope.api.utilities import JsonResponse
from flask import jsonify, request

View file

@ -1,5 +1,5 @@
from openflexure_microscope.api.utilities import JsonResponse
from openflexure_microscope.api.v1.views import MicroscopeView
from openflexure_microscope.api.views import MicroscopeView
from flask import jsonify, request
import logging

View file

@ -1,7 +1,7 @@
from openflexure_microscope.api.v1.views import MicroscopeViewPlugin
from openflexure_microscope.api.views import MicroscopeViewPlugin
from flask import Blueprint, jsonify
from openflexure_microscope.api.v1.views import MicroscopeView
from openflexure_microscope.api.views import MicroscopeView
import logging
import warnings

View file

@ -1,5 +1,5 @@
from openflexure_microscope.api.utilities import JsonResponse
from openflexure_microscope.api.v1.views import MicroscopeView
from openflexure_microscope.api.views import MicroscopeView
from openflexure_microscope.utilities import axes_to_array, filter_dict
from flask import Blueprint, jsonify, request

View file

@ -1,4 +1,4 @@
from openflexure_microscope.api.v1.views import MethodView
from openflexure_microscope.api.views import MethodView
from flask import jsonify, abort, Blueprint
from openflexure_microscope.common import tasks

View file

@ -1,28 +0,0 @@
from flask.views import MethodView
class MicroscopeView(MethodView):
"""
Create a generic MethodView with a globally available
microscope object passed as an argument.
"""
def __init__(self, microscope, **kwargs):
self.microscope = microscope
MethodView.__init__(self, **kwargs)
class MicroscopeViewPlugin(MicroscopeView):
"""
Create a generic MethodView with a globally available
microscope object passed as an argument, and a plugin
reference stored in 'self'. Initially None.
"""
def __init__(self, microscope, plugin=None, **kwargs):
self.plugin = plugin
MicroscopeView.__init__(self, microscope=microscope, **kwargs)