From c9ac940a27df89ca33ab194b07f592d820715444 Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Mon, 16 Dec 2019 16:24:36 +0000 Subject: [PATCH] Fixed URL prefix --- openflexure_microscope/api/app.py | 3 +-- openflexure_microscope/common/labthings/labthing.py | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/openflexure_microscope/api/app.py b/openflexure_microscope/api/app.py index 5917f0dc..cb952312 100644 --- a/openflexure_microscope/api/app.py +++ b/openflexure_microscope/api/app.py @@ -80,8 +80,7 @@ CORS(app, resources=r"*") handler = JSONExceptionHandler(app) # Attach lab devices -labthing = LabThing(app) -labthing.url_prefix = "/api/v2b" +labthing = LabThing(app, prefix="/api/v2b") labthing.description = "Test LabThing-based API for OpenFlexure Microscope" labthing.register_device(api_microscope, "openflexure_microscope") diff --git a/openflexure_microscope/common/labthings/labthing.py b/openflexure_microscope/common/labthings/labthing.py index 7ea2454d..d6197dfb 100644 --- a/openflexure_microscope/common/labthings/labthing.py +++ b/openflexure_microscope/common/labthings/labthing.py @@ -7,7 +7,7 @@ from . import EXTENSION_NAME class LabThing(object): - def __init__(self, app=None, url_prefix="", description=""): + def __init__(self, app=None, prefix="", description=""): self.app = app self.devices = {} @@ -17,7 +17,7 @@ class LabThing(object): self.resources = [] self.endpoints = set() - self.url_prefix = url_prefix + self.url_prefix = prefix self.description = description if app is not None: @@ -51,6 +51,8 @@ class LabThing(object): else: raise TypeError("Plugin object must be an instance of BasePlugin") + # TODO: Add plugin routes + ### Resource stuff def _complete_url(self, url_part, registration_prefix):