Fix action wrapper

The action wrapper was using an unbound function - it
now passes the extension object as self.

We were incorrectly passing endpoint names as positional arguments -
this is fixed and I now use a keyword argument.
This commit is contained in:
Richard Bowman 2021-08-17 12:11:20 +01:00
parent d7d7a8cc8d
commit 040d7d4ba6

View file

@ -216,7 +216,7 @@ def extension_action(args=None):
def post(self, arguments): def post(self, arguments):
# Run the action # Run the action
return func(**arguments) return func(self.extension, **arguments)
def get(self, *args, **kwargs): # pylint: disable=useless-super-delegation def get(self, *args, **kwargs): # pylint: disable=useless-super-delegation
# Explicitly wrap the `get` method to allow us to add a docstring # Explicitly wrap the `get` method to allow us to add a docstring
@ -294,7 +294,7 @@ class AutofocusExtension(BaseExtension):
obj = getattr(self, k) obj = getattr(self, k)
if hasattr(obj, "flask_view"): if hasattr(obj, "flask_view"):
name = obj.__name__ name = obj.__name__
self.add_view(obj.flask_view, f"/{name}", name) self.add_view(obj.flask_view, f"/{name}", endpoint=name)
def measure_sharpness( def measure_sharpness(
self, self,