mxcubeweb.core.server.resource_handler#

Functions

assert_valid_type_arguments(func)

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

valid_object_id(object_id)

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

validate_input_str(input_string)

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

Classes

AdapterResourceHandler(name, url_prefix, ...)

AdapterResourceHandler is a Flask resource handler that dynamically creates routes for hardware objects based on their attributes and methods.

ComponentResourceHandler(name, url_prefix, ...)

AdapterResourceHandler is a Flask resource handler that dynamically creates routes for hardware objects based on their attributes and methods.

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

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

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 func 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]#

Validates that the 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