Renamed Resource to View, and allow custom root links
This commit is contained in:
parent
234ebc1cbb
commit
a329b9197b
18 changed files with 90 additions and 67 deletions
|
|
@ -2,15 +2,23 @@ from openflexure_microscope.common.labthings_core.utilities import (
|
|||
get_docstring,
|
||||
get_summary,
|
||||
)
|
||||
|
||||
from .view import View
|
||||
|
||||
from flask import current_app
|
||||
|
||||
|
||||
def description_from_view(view_class):
|
||||
summary = get_summary(view_class)
|
||||
|
||||
methods = []
|
||||
for method_key in ["get", "post", "put", "delete"]:
|
||||
for method_key in View.methods:
|
||||
if hasattr(view_class, method_key):
|
||||
methods.append(method_key.upper())
|
||||
summary = get_summary(view_class)
|
||||
|
||||
# If no class summary was given, try using summaries from method functions
|
||||
if not summary:
|
||||
summary = get_summary(getattr(view_class, method_key))
|
||||
|
||||
d = {"methods": methods, "description": summary}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue