dazzler.contrib package¶
Submodules¶
dazzler.contrib.postgresql module¶
- class dazzler.contrib.postgresql.PostgresAuthenticator(app, pool=None)[source]¶
Bases:
dazzler.system.auth.Authenticator
Authenticator for PostgreSQL.
Encryption of user passwords with scrypt.
- Tables
users
role
user_roles
- Configuration
[authentication] authenticator = 'dazzler.contrib.postgresql:PostgresAuthenticator' [postgres] dsn = 'host=localhost port=5432 dbname=mydb' [postgres.auth] schema_name = 'public' user_table_name = 'users'
- async authenticate(username, password)[source]¶
For login purpose.
- Parameters
username (
str
) –password (
str
) –
- Returns
- async get_user(username)[source]¶
Retrieve a user by it’s username.
- Parameters
username (
str
) –- Returns
- class dazzler.contrib.postgresql.PostgresConfig(config_format=ConfigFormat.TOML, root_name='config')[source]¶
Bases:
precept._configs.Config
- class Postgres(parent=None, parent_len=0)[source]¶
Bases:
precept._configs.Nestable
- class Auth(parent=None, parent_len=0)[source]¶
Bases:
precept._configs.Nestable
- class Encryption(parent=None, parent_len=0)[source]¶
Bases:
precept._configs.Nestable
- blocksize¶
- cost_factor¶
- dklen¶
- maxmem¶
- parallelism¶
- default_user_roles¶
- role_table_name¶
- roles¶
- schema_name¶
- user_roles_table_name¶
- user_table_name¶
- class Middleware(parent=None, parent_len=0)[source]¶
Bases:
precept._configs.Nestable
- app_key¶
- request_key¶
- class Session(parent=None, parent_len=0)[source]¶
Bases:
precept._configs.Nestable
- schema_name¶
- table_name¶
- dsn¶
- class dazzler.contrib.postgresql.PostgresMiddleware(app, config, pool=None)[source]¶
Bases:
dazzler.system._middleware.Middleware
- class dazzler.contrib.postgresql.PostgresSessionBackend(app, config=None, pool=None)[source]¶
Bases:
dazzler.system.session.SessionBackEnd
Session backend for PostgreSQL.
- Tables
session
- Configuration
[session] backend = 'PostgreSQL'
- __init__(app, config=None, pool=None)[source]¶
- Parameters
app (dazzler.Dazzler) – Running dazzler app.
- async delete(session_id, key)[source]¶
Delete a session key value.
- Parameters
session_id (
str
) – Session to delete the key for.key (
str
) – The key to delete.
- Returns
- class dazzler.contrib.postgresql.PostgresUserAdminPage(app, config=None, **kwargs)[source]¶
Bases:
dazzler.pages.user_admin.UserAdminPage
Implementation of UserAdminPage for PostgreSQL.
- Configuration
[authentication.admin] enable = true page_ref = 'dazzler.contrib.postgresql:PostgresUserAdminPage'
- __init__(app, config=None, **kwargs)[source]¶
- Parameters
name – Unique name for the page, usually give __name__.
layout – Root component or function returning a Component. In the case of a function, the request will be None on setup.
url – Url, default to
/name
.bindings – Bindings of component aspects for this page.
routes – Additional routes to register with this page.
requirements – List of requirements to
title – Title of the page.
lang – lang attribute of the html tag.
header – Static header to include as first child on the page.
footer – Static footer to include as last child on the page.
favicon – Url to favicon for the page.
meta_tags – Meta tags of the page.
packages – Packages list to use on the page instead of the whole registry.
require_login – Page requires that user is logged in.
electron_window – Settings for the electron window like size.
authorizations – Rules for authorization.
dazzler.contrib.redis module¶
- class dazzler.contrib.redis.RedisMiddleware(app, redis=None)[source]¶
Bases:
dazzler.system._middleware.Middleware
Insert the aioredis pool instance into the aiohttp app and requests.
- class dazzler.contrib.redis.RedisSessionBackend(app, redis=None)[source]¶
Bases:
dazzler.system.session.SessionBackEnd
Backed by aioredis.
Values are serialized to json first to keep the types.
Install with
pip install dazzler[redis]
- Seealso
- async delete(session_id, key)[source]¶
Delete a session key value.
- Parameters
session_id (
str
) – Session to delete the key for.key (
str
) – The key to delete.
- Returns