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

@ -0,0 +1,28 @@
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)