Cleaned code structure

This commit is contained in:
jtc42 2020-01-06 16:45:38 +00:00
parent 79abc3fee3
commit 70149e9732
20 changed files with 196 additions and 332 deletions

View file

@ -1,23 +1,12 @@
from flask.views import MethodView
from openflexure_microscope.common.labthings_core.resource import BaseResource
class Resource(MethodView):
class Resource(MethodView, BaseResource):
"""Currently identical to MethodView
"""
endpoint = None
methods = ["get", "post", "put", "delete"]
def __init__(self, *args, **kwargs):
MethodView.__init__(self, *args, **kwargs)
def doc(self):
docs = {"operations": {}}
if hasattr(self, "__apispec__"):
docs.update(self.__apispec__)
for meth in Resource.methods:
if hasattr(self, meth) and hasattr(getattr(self, meth), "__apispec__"):
docs["operations"][meth] = {}
docs["operations"][meth] = getattr(self, meth).__apispec__
return docs