From 040d7d4ba6852ec888a3c04938d41af3812f5749 Mon Sep 17 00:00:00 2001 From: Richard Bowman Date: Tue, 17 Aug 2021 12:11:20 +0100 Subject: [PATCH] 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. --- openflexure_microscope/api/default_extensions/autofocus.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openflexure_microscope/api/default_extensions/autofocus.py b/openflexure_microscope/api/default_extensions/autofocus.py index 241ea9cd..5f736121 100644 --- a/openflexure_microscope/api/default_extensions/autofocus.py +++ b/openflexure_microscope/api/default_extensions/autofocus.py @@ -216,7 +216,7 @@ def extension_action(args=None): def post(self, arguments): # Run the action - return func(**arguments) + return func(self.extension, **arguments) def get(self, *args, **kwargs): # pylint: disable=useless-super-delegation # Explicitly wrap the `get` method to allow us to add a docstring @@ -294,7 +294,7 @@ class AutofocusExtension(BaseExtension): obj = getattr(self, k) if hasattr(obj, "flask_view"): 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( self,