joop.flask.flask_view — joop 0.0.1 documentation

# joop.flask.flask_view

Flask view integration for joop.

This module provides a base class for integrating joop views with Flask applications.

Any regular joop View can do multiple inheritance with a FlaskView to result

  in a class that can be used with Flask.

Functionality include jinja env proxying.

Classes:
  FlaskView:

    A base class for creating Flask-compatible views from joop View classes.

Classes

`FlaskView`() | A base class for creating Flask-compatible views from joop View classes.

class joop.flask.flask_view.FlaskView

  Bases: `View`

  A base class for creating Flask-compatible views from joop View classes.

  This class provides methods to integrate joop views with Flask applications by adding URL rules and accessing the Flask Jinja2 environment.

  Use multiple inheritance to make your View a FlaskView ex.

  class FlaskHello(HelloView, FlaskView):

  _add_to_app(app

    Flask, view_func: callable): Adds the view to a Flask application with the specified view function.

  _get_jinja_env()

    Retrieves the Jinja2 environment from the current Flask application context.

  class Endpoint

    Bases: `object`

  classmethod add_to_app(app: object)

    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.

  classmethod get_jinja_env()

    Retrieve the Jinja2 environment by calling the abstract method.

    Returns:

      The Jinja2 environment associated with the view.

    Return type:

      jinja2.Environment

  classmethod render(**kwargs)

    Render the component and return the rendered output as a string.

    Parameters:

      **kwargs – Keyword arguments to be passed to the component’s inputs and subcomponents.

    Returns:

      The rendered output of the component.

    Return type:

      str