Skip to content

Base route

Generic route handler base class for odin-control.

This module implements the BaseRouteHandler class on which API handlers are based. This is a wrapper around the Tornado RequestHandler, adding the handler mixin to provide CORS and Server header behaviour.

Tim Nicholls, STFC Detector Systems Software Group

BaseRouteHandler

Bases: HandlerMixin, RequestHandler

Base route handler class with CORS and server-header support.

Source code in src/odin_control/http/handlers/base_route.py
class BaseRouteHandler(HandlerMixin, RequestHandler):
    """Base route handler class with CORS and server-header support."""

    def __init__(self, *args, **kwargs):
        """Construct the BaseRouteHandler object."""
        self.route: Any = None
        super().__init__(*args, **kwargs)

    def initialize(self, route, **kwargs):
        """Initialise the BaseRouteHandler object with route and optional kwargs."""
        self.route = route
        super().initialize(**kwargs)

__init__(*args, **kwargs)

Construct the BaseRouteHandler object.

Source code in src/odin_control/http/handlers/base_route.py
def __init__(self, *args, **kwargs):
    """Construct the BaseRouteHandler object."""
    self.route: Any = None
    super().__init__(*args, **kwargs)

initialize(route, **kwargs)

Initialise the BaseRouteHandler object with route and optional kwargs.

Source code in src/odin_control/http/handlers/base_route.py
def initialize(self, route, **kwargs):
    """Initialise the BaseRouteHandler object with route and optional kwargs."""
    self.route = route
    super().initialize(**kwargs)