joop.web.view¶
- Views are how components are integrated with webservers. The view (or route) is defined
and established by this class.
- Classes:
- View:
The base class for defining and managing views in the joop project.
Classes
|
The base class for defining and managing views in the joop project. |
- class joop.web.view.View[source]¶
Bases:
objectThe base class for defining and managing views in the joop project.
This class provides methods for rendering components, managing inputs and subcomponents, and integrating views with web frameworks.
- _args_to_inputs¶
Determines whether to automatically map arguments to component inputs.
- Type:
bool
- _get_default_subs¶
Determines whether to automatically retrieve default subcomponents.
- Type:
bool
- _as_response¶
Determines whether the view should render a response instead of a component.
- Type:
bool
- _get_inputs(**kwargs)[source]¶
Retrieves the inputs for the component based on the provided keyword arguments.
- _add_to_app(app
object, view_func: Callable): Abstract method to add the view to a web application.
- add_to_app(app
object): Adds the view to a web application with the specified configuration.
- _get_jinja_env()¶
Abstract method to retrieve the Jinja2 environment.
- classmethod add_to_app(app: object)[source]¶
Add the view to a web application with the specified configuration.
This method validates the view’s configuration and registers it with the web application using the _add_to_app method.
- Parameters:
app (object) – The web application instance.
- Raises:
NotImplementedError – If the view’s configuration is incomplete or invalid.