mxcubeweb.core.server.resource_handler#

Functions

assert_valid_type_arguments(func)

Make sure that all the arguments of the function are typehinted correctly.

valid_object_id(object_id)

Validate that object_id contains only A-Z, a-z, and . , _.

validate_input_str(input_string)

Validate that input string contains only alphanumeric characters and/or dot (.).

Classes

AdapterResourceHandler(name, url_prefix, ...)

Flask resource handler that dynamically creates routes for hardware objects.

ComponentResourceHandler(name, url_prefix, ...)

Flask resource handler that dynamically creates routes for hardware objects.

ResourceHandler(name, url_prefix, ...)

ResourceHandlerFactory()

class mxcubeweb.core.server.resource_handler.AdapterResourceHandler(name: str, url_prefix: str, handler_dict: dict[str, object], app: object, exports: list[dict[str, str]], commands: list[str], attributes: list[str])[source]#

Bases: ResourceHandler

Flask resource handler that dynamically creates routes for hardware objects.

AdapterResourceHandler is a Flask resource handler that dynamically creates routes for hardware objects based on their attributes and methods. It supports GET and PUT requests for attributes and commands respectively.

Parameters:
class mxcubeweb.core.server.resource_handler.ComponentResourceHandler(name: str, url_prefix: str, handler_dict: dict[str, object], app: object, exports: list[dict[str, str]], commands: list[str], attributes: list[str])[source]#

Bases: ResourceHandler

Flask resource handler that dynamically creates routes for hardware objects.

AdapterResourceHandler is a Flask resource handler that dynamically creates routes for hardware objects based on their attributes and methods. It supports GET and PUT requests for attributes and commands respectively.

Parameters:
mxcubeweb.core.server.resource_handler.assert_valid_type_arguments(func)[source]#

Make sure that all the arguments of the function are typehinted correctly.

Make sure that all the arguments of the function are typehinted as pydantic model, float, int, str or bool

mxcubeweb.core.server.resource_handler.valid_object_id(object_id: str) bool[source]#

Validate that object_id contains only A-Z, a-z, and . , _.

Parameters:

object_id (str) – The string to validate.

Returns:

True if the string is valid, False otherwise.

Return type:

bool

mxcubeweb.core.server.resource_handler.validate_input_str(input_string: str) bool[source]#

Validate that input string contains only alphanumeric characters and/or dot (.).

Parameters:

input_string (str) – The string to validate.

Returns:

True if the string is valid, False otherwise.

Return type:

bool