ToUIBlueprint#

class toui.structure.ToUIBlueprint(*args, **kwargs)[source]#

Bases: Blueprint

A class that inherits flask.Blueprint.

The difference between this class and flask.Blueprint is that you can add Page objects to this class. To learn how to use blueprints, check flask’s documentation https://flask.palletsprojects.com/.

Examples

Creating a blueprint:

>>> from toui import ToUIBlueprint
>>> blueprint = ToUIBlueprint("Blueprint", __name__)

Adding a Page to a blueprint:

>>> from toui import Page
>>> page = Page(html_str="<h1>This page is part of a blueprint</h1>", url="/")
>>> blueprint.add_pages(page)

Creating a Website and adding the blueprint to it:

>>> from toui import Website
>>> app = Website(__name__)
>>> app.register_toui_blueprint(blueprint)

See also

flask.Blueprint

Parameters:
  • argsflask.Blueprint arguments.

  • kwargsflask.Blueprint keyword arguments.

Methods#

toui.structure.ToUIBlueprint.add_pages

Adds pages to the blueprint.

toui.structure.ToUIBlueprint.register_toui_blueprint

Registers a ToUIBlueprint object.