pypnusershub.routes

Module Contents

Classes

ConfigurableBlueprint

Represents a blueprint, a collection of routes and other

Functions

login()

public_login()

logout()

insert_or_update_organism(organism)

Insert a organism

insert_or_update_role(data)

Insert or update a role (also add groups if provided)

Attributes

log

routes

pypnusershub.routes.log[source]
class pypnusershub.routes.ConfigurableBlueprint(name: str, import_name: str, static_folder: str | os.PathLike | None = None, static_url_path: str | None = None, template_folder: str | os.PathLike | None = None, url_prefix: str | None = None, subdomain: str | None = None, url_defaults: dict | None = None, root_path: str | None = None, cli_group: str | None = _sentinel)[source]

Bases: flask.Blueprint

Represents a blueprint, a collection of routes and other app-related functions that can be registered on a real application later.

A blueprint is an object that allows defining application functions without requiring an application object ahead of time. It uses the same decorators as Flask, but defers the need for an application by recording them for later registration.

Decorating a function with a blueprint creates a deferred function that is called with BlueprintSetupState when the blueprint is registered on an application.

See /blueprints for more information.

Paramètres:
  • name – The name of the blueprint. Will be prepended to each endpoint name.

  • import_name – The name of the blueprint package, usually __name__. This helps locate the root_path for the blueprint.

  • static_folder – A folder with static files that should be served by the blueprint’s static route. The path is relative to the blueprint’s root path. Blueprint static files are disabled by default.

  • static_url_path – The url to serve static files from. Defaults to static_folder. If the blueprint does not have a url_prefix, the app’s static route will take precedence, and the blueprint’s static files won’t be accessible.

  • template_folder – A folder with templates that should be added to the app’s template search path. The path is relative to the blueprint’s root path. Blueprint templates are disabled by default. Blueprint templates have a lower precedence than those in the app’s templates folder.

  • url_prefix – A path to prepend to all of the blueprint’s URLs, to make them distinct from the rest of the app’s routes.

  • subdomain – A subdomain that blueprint routes will match on by default.

  • url_defaults – A dict of default values that blueprint routes will receive by default.

  • root_path – By default, the blueprint will automatically set this based on import_name. In certain situations this automatic detection can fail, so the path can be specified manually instead.

Modifié dans la version 1.1.0: Blueprints have a cli group to register nested CLI commands. The cli_group parameter controls the name of the group under the flask command.

Nouveau dans la version 0.7.

register(app, *args, **kwargs)[source]

Called by Flask.register_blueprint() to register all views and callbacks registered on the blueprint with the application. Creates a BlueprintSetupState and calls each record() callback with it.

Paramètres:
  • app – The application this blueprint is being registered with.

  • options – Keyword arguments forwarded from register_blueprint().

Modifié dans la version 2.3: Nested blueprints now correctly apply subdomains.

Modifié dans la version 2.1: Registering the same blueprint with the same name multiple times is an error.

Modifié dans la version 2.0.1: Nested blueprints are registered with their dotted name. This allows different blueprints with the same name to be nested at different locations.

Modifié dans la version 2.0.1: The name option can be used to change the (pre-dotted) name the blueprint is registered with. This allows the same blueprint to be registered multiple times with unique names for url_for.

pypnusershub.routes.routes[source]
pypnusershub.routes.login()[source]
pypnusershub.routes.public_login()[source]
pypnusershub.routes.logout()[source]
pypnusershub.routes.insert_or_update_organism(organism)[source]

Insert a organism

pypnusershub.routes.insert_or_update_role(data)[source]

Insert or update a role (also add groups if provided)