fix: format all code with black
and from now on should not deviate from that...
This commit is contained in:
parent
e20ef31ff7
commit
1b01df79e2
9 changed files with 312 additions and 144 deletions
31
docs/conf.py
31
docs/conf.py
|
@ -8,32 +8,35 @@
|
|||
|
||||
from importlib.metadata import version as get_version
|
||||
|
||||
project = 'Wutta-Continuum'
|
||||
copyright = '2024, Lance Edgar'
|
||||
author = 'Lance Edgar'
|
||||
release = get_version('Wutta-Continuum')
|
||||
project = "Wutta-Continuum"
|
||||
copyright = "2024, Lance Edgar"
|
||||
author = "Lance Edgar"
|
||||
release = get_version("Wutta-Continuum")
|
||||
|
||||
# -- General configuration ---------------------------------------------------
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
||||
|
||||
extensions = [
|
||||
'sphinx.ext.autodoc',
|
||||
'sphinx.ext.intersphinx',
|
||||
'sphinx.ext.viewcode',
|
||||
'sphinx.ext.todo',
|
||||
"sphinx.ext.autodoc",
|
||||
"sphinx.ext.intersphinx",
|
||||
"sphinx.ext.viewcode",
|
||||
"sphinx.ext.todo",
|
||||
]
|
||||
|
||||
templates_path = ['_templates']
|
||||
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
|
||||
templates_path = ["_templates"]
|
||||
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
|
||||
|
||||
intersphinx_mapping = {
|
||||
'sqlalchemy-continuum': ('https://sqlalchemy-continuum.readthedocs.io/en/latest/', None),
|
||||
'wuttjamaican': ('https://docs.wuttaproject.org/wuttjamaican/', None),
|
||||
"sqlalchemy-continuum": (
|
||||
"https://sqlalchemy-continuum.readthedocs.io/en/latest/",
|
||||
None,
|
||||
),
|
||||
"wuttjamaican": ("https://docs.wuttaproject.org/wuttjamaican/", None),
|
||||
}
|
||||
|
||||
|
||||
# -- Options for HTML output -------------------------------------------------
|
||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
||||
|
||||
html_theme = 'furo'
|
||||
html_static_path = ['_static']
|
||||
html_theme = "furo"
|
||||
html_static_path = ["_static"]
|
||||
|
|
|
@ -3,4 +3,4 @@
|
|||
from importlib.metadata import version
|
||||
|
||||
|
||||
__version__ = version('Wutta-Continuum')
|
||||
__version__ = version("Wutta-Continuum")
|
||||
|
|
|
@ -40,5 +40,6 @@ class WuttaContinuumAppProvider(AppProvider):
|
|||
This checks the config value as described in
|
||||
:doc:`/narr/install`; default will be ``False``.
|
||||
"""
|
||||
return self.config.get_bool('wutta_continuum.enable_versioning',
|
||||
usedb=False, default=False)
|
||||
return self.config.get_bool(
|
||||
"wutta_continuum.enable_versioning", usedb=False, default=False
|
||||
)
|
||||
|
|
|
@ -42,19 +42,23 @@ class WuttaContinuumConfigExtension(WuttaConfigExtension):
|
|||
This adds a startup hook, which can optionally turn on the
|
||||
SQLAlchemy-Continuum versioning features for the main app DB.
|
||||
"""
|
||||
key = 'wutta_continuum'
|
||||
|
||||
key = "wutta_continuum"
|
||||
|
||||
def startup(self, config):
|
||||
""" """
|
||||
# only do this if config enables it
|
||||
if not config.get_bool('wutta_continuum.enable_versioning',
|
||||
usedb=False, default=False):
|
||||
if not config.get_bool(
|
||||
"wutta_continuum.enable_versioning", usedb=False, default=False
|
||||
):
|
||||
return
|
||||
|
||||
# create wutta plugin, to assign user and ip address
|
||||
spec = config.get('wutta_continuum.wutta_plugin_spec',
|
||||
spec = config.get(
|
||||
"wutta_continuum.wutta_plugin_spec",
|
||||
usedb=False,
|
||||
default='wutta_continuum.conf:WuttaContinuumPlugin')
|
||||
default="wutta_continuum.conf:WuttaContinuumPlugin",
|
||||
)
|
||||
WuttaPlugin = load_object(spec)
|
||||
|
||||
# tell sqlalchemy-continuum to do its thing
|
||||
|
@ -109,10 +113,10 @@ class WuttaContinuumPlugin(Plugin):
|
|||
|
||||
remote_addr = self.get_remote_addr(uow, session)
|
||||
if remote_addr:
|
||||
kwargs['remote_addr'] = remote_addr
|
||||
kwargs["remote_addr"] = remote_addr
|
||||
|
||||
user_id = self.get_user_id(uow, session)
|
||||
if user_id:
|
||||
kwargs['user_id'] = user_id
|
||||
kwargs["user_id"] = user_id
|
||||
|
||||
return kwargs
|
||||
|
|
|
@ -5,6 +5,7 @@ Revises: 71406251b8e7
|
|||
Create Date: 2024-11-24 17:39:57.415425
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
|
@ -12,8 +13,8 @@ import sqlalchemy as sa
|
|||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '0a5f8ac0cd06'
|
||||
down_revision: Union[str, None] = '71406251b8e7'
|
||||
revision: str = "0a5f8ac0cd06"
|
||||
down_revision: Union[str, None] = "71406251b8e7"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
@ -21,10 +22,13 @@ depends_on: Union[str, Sequence[str], None] = None
|
|||
def upgrade() -> None:
|
||||
|
||||
# user
|
||||
op.add_column('user_version', sa.Column('prevent_edit', sa.Boolean(), autoincrement=False, nullable=True))
|
||||
op.add_column(
|
||||
"user_version",
|
||||
sa.Column("prevent_edit", sa.Boolean(), autoincrement=False, nullable=True),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
|
||||
# user
|
||||
op.drop_column('user_version', 'prevent_edit')
|
||||
op.drop_column("user_version", "prevent_edit")
|
||||
|
|
|
@ -5,6 +5,7 @@ Revises:
|
|||
Create Date: 2024-08-27 18:28:31.488291
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
|
@ -13,131 +14,283 @@ import wuttjamaican.db.util
|
|||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '71406251b8e7'
|
||||
revision: str = "71406251b8e7"
|
||||
down_revision: Union[str, None] = None
|
||||
branch_labels: Union[str, Sequence[str], None] = ('wutta_continuum',)
|
||||
branch_labels: Union[str, Sequence[str], None] = ("wutta_continuum",)
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
|
||||
# transaction
|
||||
op.create_table('transaction',
|
||||
sa.Column('issued_at', sa.DateTime(), nullable=True),
|
||||
sa.Column('id', sa.BigInteger(), autoincrement=True, nullable=False),
|
||||
sa.Column('remote_addr', sa.String(length=50), nullable=True),
|
||||
sa.Column('user_id', wuttjamaican.db.util.UUID(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['user.uuid'], name=op.f('fk_transaction_user_id_user')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_transaction'))
|
||||
op.create_table(
|
||||
"transaction",
|
||||
sa.Column("issued_at", sa.DateTime(), nullable=True),
|
||||
sa.Column("id", sa.BigInteger(), autoincrement=True, nullable=False),
|
||||
sa.Column("remote_addr", sa.String(length=50), nullable=True),
|
||||
sa.Column("user_id", wuttjamaican.db.util.UUID(), nullable=True),
|
||||
sa.ForeignKeyConstraint(
|
||||
["user_id"], ["user.uuid"], name=op.f("fk_transaction_user_id_user")
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id", name=op.f("pk_transaction")),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_transaction_user_id"), "transaction", ["user_id"], unique=False
|
||||
)
|
||||
op.create_index(op.f('ix_transaction_user_id'), 'transaction', ['user_id'], unique=False)
|
||||
|
||||
# person
|
||||
op.create_table('person_version',
|
||||
sa.Column('uuid', wuttjamaican.db.util.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('full_name', sa.String(length=100), autoincrement=False, nullable=True),
|
||||
sa.Column('first_name', sa.String(length=50), autoincrement=False, nullable=True),
|
||||
sa.Column('middle_name', sa.String(length=50), autoincrement=False, nullable=True),
|
||||
sa.Column('last_name', sa.String(length=50), autoincrement=False, nullable=True),
|
||||
sa.Column('transaction_id', sa.BigInteger(), autoincrement=False, nullable=False),
|
||||
sa.Column('end_transaction_id', sa.BigInteger(), nullable=True),
|
||||
sa.Column('operation_type', sa.SmallInteger(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('uuid', 'transaction_id', name=op.f('pk_person_version'))
|
||||
op.create_table(
|
||||
"person_version",
|
||||
sa.Column(
|
||||
"uuid", wuttjamaican.db.util.UUID(), autoincrement=False, nullable=False
|
||||
),
|
||||
sa.Column(
|
||||
"full_name", sa.String(length=100), autoincrement=False, nullable=True
|
||||
),
|
||||
sa.Column(
|
||||
"first_name", sa.String(length=50), autoincrement=False, nullable=True
|
||||
),
|
||||
sa.Column(
|
||||
"middle_name", sa.String(length=50), autoincrement=False, nullable=True
|
||||
),
|
||||
sa.Column(
|
||||
"last_name", sa.String(length=50), autoincrement=False, nullable=True
|
||||
),
|
||||
sa.Column(
|
||||
"transaction_id", sa.BigInteger(), autoincrement=False, nullable=False
|
||||
),
|
||||
sa.Column("end_transaction_id", sa.BigInteger(), nullable=True),
|
||||
sa.Column("operation_type", sa.SmallInteger(), nullable=False),
|
||||
sa.PrimaryKeyConstraint(
|
||||
"uuid", "transaction_id", name=op.f("pk_person_version")
|
||||
),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_person_version_end_transaction_id"),
|
||||
"person_version",
|
||||
["end_transaction_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_person_version_operation_type"),
|
||||
"person_version",
|
||||
["operation_type"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_person_version_transaction_id"),
|
||||
"person_version",
|
||||
["transaction_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(op.f('ix_person_version_end_transaction_id'), 'person_version', ['end_transaction_id'], unique=False)
|
||||
op.create_index(op.f('ix_person_version_operation_type'), 'person_version', ['operation_type'], unique=False)
|
||||
op.create_index(op.f('ix_person_version_transaction_id'), 'person_version', ['transaction_id'], unique=False)
|
||||
|
||||
# user
|
||||
op.create_table('user_version',
|
||||
sa.Column('uuid', wuttjamaican.db.util.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('username', sa.String(length=25), autoincrement=False, nullable=True),
|
||||
sa.Column('password', sa.String(length=60), autoincrement=False, nullable=True),
|
||||
sa.Column('person_uuid', wuttjamaican.db.util.UUID(), autoincrement=False, nullable=True),
|
||||
sa.Column('active', sa.Boolean(), autoincrement=False, nullable=True),
|
||||
sa.Column('transaction_id', sa.BigInteger(), autoincrement=False, nullable=False),
|
||||
sa.Column('end_transaction_id', sa.BigInteger(), nullable=True),
|
||||
sa.Column('operation_type', sa.SmallInteger(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('uuid', 'transaction_id', name=op.f('pk_user_version'))
|
||||
op.create_table(
|
||||
"user_version",
|
||||
sa.Column(
|
||||
"uuid", wuttjamaican.db.util.UUID(), autoincrement=False, nullable=False
|
||||
),
|
||||
sa.Column("username", sa.String(length=25), autoincrement=False, nullable=True),
|
||||
sa.Column("password", sa.String(length=60), autoincrement=False, nullable=True),
|
||||
sa.Column(
|
||||
"person_uuid",
|
||||
wuttjamaican.db.util.UUID(),
|
||||
autoincrement=False,
|
||||
nullable=True,
|
||||
),
|
||||
sa.Column("active", sa.Boolean(), autoincrement=False, nullable=True),
|
||||
sa.Column(
|
||||
"transaction_id", sa.BigInteger(), autoincrement=False, nullable=False
|
||||
),
|
||||
sa.Column("end_transaction_id", sa.BigInteger(), nullable=True),
|
||||
sa.Column("operation_type", sa.SmallInteger(), nullable=False),
|
||||
sa.PrimaryKeyConstraint("uuid", "transaction_id", name=op.f("pk_user_version")),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_user_version_end_transaction_id"),
|
||||
"user_version",
|
||||
["end_transaction_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_user_version_operation_type"),
|
||||
"user_version",
|
||||
["operation_type"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_user_version_transaction_id"),
|
||||
"user_version",
|
||||
["transaction_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(op.f('ix_user_version_end_transaction_id'), 'user_version', ['end_transaction_id'], unique=False)
|
||||
op.create_index(op.f('ix_user_version_operation_type'), 'user_version', ['operation_type'], unique=False)
|
||||
op.create_index(op.f('ix_user_version_transaction_id'), 'user_version', ['transaction_id'], unique=False)
|
||||
|
||||
# role
|
||||
op.create_table('role_version',
|
||||
sa.Column('uuid', wuttjamaican.db.util.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('name', sa.String(length=100), autoincrement=False, nullable=True),
|
||||
sa.Column('notes', sa.Text(), autoincrement=False, nullable=True),
|
||||
sa.Column('transaction_id', sa.BigInteger(), autoincrement=False, nullable=False),
|
||||
sa.Column('end_transaction_id', sa.BigInteger(), nullable=True),
|
||||
sa.Column('operation_type', sa.SmallInteger(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('uuid', 'transaction_id', name=op.f('pk_role_version'))
|
||||
op.create_table(
|
||||
"role_version",
|
||||
sa.Column(
|
||||
"uuid", wuttjamaican.db.util.UUID(), autoincrement=False, nullable=False
|
||||
),
|
||||
sa.Column("name", sa.String(length=100), autoincrement=False, nullable=True),
|
||||
sa.Column("notes", sa.Text(), autoincrement=False, nullable=True),
|
||||
sa.Column(
|
||||
"transaction_id", sa.BigInteger(), autoincrement=False, nullable=False
|
||||
),
|
||||
sa.Column("end_transaction_id", sa.BigInteger(), nullable=True),
|
||||
sa.Column("operation_type", sa.SmallInteger(), nullable=False),
|
||||
sa.PrimaryKeyConstraint("uuid", "transaction_id", name=op.f("pk_role_version")),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_role_version_end_transaction_id"),
|
||||
"role_version",
|
||||
["end_transaction_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_role_version_operation_type"),
|
||||
"role_version",
|
||||
["operation_type"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_role_version_transaction_id"),
|
||||
"role_version",
|
||||
["transaction_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(op.f('ix_role_version_end_transaction_id'), 'role_version', ['end_transaction_id'], unique=False)
|
||||
op.create_index(op.f('ix_role_version_operation_type'), 'role_version', ['operation_type'], unique=False)
|
||||
op.create_index(op.f('ix_role_version_transaction_id'), 'role_version', ['transaction_id'], unique=False)
|
||||
|
||||
# user_x_role
|
||||
op.create_table('user_x_role_version',
|
||||
sa.Column('uuid', wuttjamaican.db.util.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('user_uuid', wuttjamaican.db.util.UUID(), autoincrement=False, nullable=True),
|
||||
sa.Column('role_uuid', wuttjamaican.db.util.UUID(), autoincrement=False, nullable=True),
|
||||
sa.Column('transaction_id', sa.BigInteger(), autoincrement=False, nullable=False),
|
||||
sa.Column('end_transaction_id', sa.BigInteger(), nullable=True),
|
||||
sa.Column('operation_type', sa.SmallInteger(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('uuid', 'transaction_id', name=op.f('pk_user_x_role_version'))
|
||||
op.create_table(
|
||||
"user_x_role_version",
|
||||
sa.Column(
|
||||
"uuid", wuttjamaican.db.util.UUID(), autoincrement=False, nullable=False
|
||||
),
|
||||
sa.Column(
|
||||
"user_uuid", wuttjamaican.db.util.UUID(), autoincrement=False, nullable=True
|
||||
),
|
||||
sa.Column(
|
||||
"role_uuid", wuttjamaican.db.util.UUID(), autoincrement=False, nullable=True
|
||||
),
|
||||
sa.Column(
|
||||
"transaction_id", sa.BigInteger(), autoincrement=False, nullable=False
|
||||
),
|
||||
sa.Column("end_transaction_id", sa.BigInteger(), nullable=True),
|
||||
sa.Column("operation_type", sa.SmallInteger(), nullable=False),
|
||||
sa.PrimaryKeyConstraint(
|
||||
"uuid", "transaction_id", name=op.f("pk_user_x_role_version")
|
||||
),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_user_x_role_version_end_transaction_id"),
|
||||
"user_x_role_version",
|
||||
["end_transaction_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_user_x_role_version_operation_type"),
|
||||
"user_x_role_version",
|
||||
["operation_type"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_user_x_role_version_transaction_id"),
|
||||
"user_x_role_version",
|
||||
["transaction_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(op.f('ix_user_x_role_version_end_transaction_id'), 'user_x_role_version', ['end_transaction_id'], unique=False)
|
||||
op.create_index(op.f('ix_user_x_role_version_operation_type'), 'user_x_role_version', ['operation_type'], unique=False)
|
||||
op.create_index(op.f('ix_user_x_role_version_transaction_id'), 'user_x_role_version', ['transaction_id'], unique=False)
|
||||
|
||||
# permission
|
||||
op.create_table('permission_version',
|
||||
sa.Column('role_uuid', wuttjamaican.db.util.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('permission', sa.String(length=254), autoincrement=False, nullable=False),
|
||||
sa.Column('transaction_id', sa.BigInteger(), autoincrement=False, nullable=False),
|
||||
sa.Column('end_transaction_id', sa.BigInteger(), nullable=True),
|
||||
sa.Column('operation_type', sa.SmallInteger(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('role_uuid', 'permission', 'transaction_id', name=op.f('pk_permission_version'))
|
||||
op.create_table(
|
||||
"permission_version",
|
||||
sa.Column(
|
||||
"role_uuid",
|
||||
wuttjamaican.db.util.UUID(),
|
||||
autoincrement=False,
|
||||
nullable=False,
|
||||
),
|
||||
sa.Column(
|
||||
"permission", sa.String(length=254), autoincrement=False, nullable=False
|
||||
),
|
||||
sa.Column(
|
||||
"transaction_id", sa.BigInteger(), autoincrement=False, nullable=False
|
||||
),
|
||||
sa.Column("end_transaction_id", sa.BigInteger(), nullable=True),
|
||||
sa.Column("operation_type", sa.SmallInteger(), nullable=False),
|
||||
sa.PrimaryKeyConstraint(
|
||||
"role_uuid",
|
||||
"permission",
|
||||
"transaction_id",
|
||||
name=op.f("pk_permission_version"),
|
||||
),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_permission_version_end_transaction_id"),
|
||||
"permission_version",
|
||||
["end_transaction_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_permission_version_operation_type"),
|
||||
"permission_version",
|
||||
["operation_type"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_permission_version_transaction_id"),
|
||||
"permission_version",
|
||||
["transaction_id"],
|
||||
unique=False,
|
||||
)
|
||||
op.create_index(op.f('ix_permission_version_end_transaction_id'), 'permission_version', ['end_transaction_id'], unique=False)
|
||||
op.create_index(op.f('ix_permission_version_operation_type'), 'permission_version', ['operation_type'], unique=False)
|
||||
op.create_index(op.f('ix_permission_version_transaction_id'), 'permission_version', ['transaction_id'], unique=False)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
|
||||
# permission
|
||||
op.drop_index(op.f('ix_permission_version_transaction_id'), table_name='permission_version')
|
||||
op.drop_index(op.f('ix_permission_version_operation_type'), table_name='permission_version')
|
||||
op.drop_index(op.f('ix_permission_version_end_transaction_id'), table_name='permission_version')
|
||||
op.drop_table('permission_version')
|
||||
op.drop_index(
|
||||
op.f("ix_permission_version_transaction_id"), table_name="permission_version"
|
||||
)
|
||||
op.drop_index(
|
||||
op.f("ix_permission_version_operation_type"), table_name="permission_version"
|
||||
)
|
||||
op.drop_index(
|
||||
op.f("ix_permission_version_end_transaction_id"),
|
||||
table_name="permission_version",
|
||||
)
|
||||
op.drop_table("permission_version")
|
||||
|
||||
# user_x_role
|
||||
op.drop_index(op.f('ix_user_x_role_version_transaction_id'), table_name='user_x_role_version')
|
||||
op.drop_index(op.f('ix_user_x_role_version_operation_type'), table_name='user_x_role_version')
|
||||
op.drop_index(op.f('ix_user_x_role_version_end_transaction_id'), table_name='user_x_role_version')
|
||||
op.drop_table('user_x_role_version')
|
||||
op.drop_index(
|
||||
op.f("ix_user_x_role_version_transaction_id"), table_name="user_x_role_version"
|
||||
)
|
||||
op.drop_index(
|
||||
op.f("ix_user_x_role_version_operation_type"), table_name="user_x_role_version"
|
||||
)
|
||||
op.drop_index(
|
||||
op.f("ix_user_x_role_version_end_transaction_id"),
|
||||
table_name="user_x_role_version",
|
||||
)
|
||||
op.drop_table("user_x_role_version")
|
||||
|
||||
# role
|
||||
op.drop_index(op.f('ix_role_version_transaction_id'), table_name='role_version')
|
||||
op.drop_index(op.f('ix_role_version_operation_type'), table_name='role_version')
|
||||
op.drop_index(op.f('ix_role_version_end_transaction_id'), table_name='role_version')
|
||||
op.drop_table('role_version')
|
||||
op.drop_index(op.f("ix_role_version_transaction_id"), table_name="role_version")
|
||||
op.drop_index(op.f("ix_role_version_operation_type"), table_name="role_version")
|
||||
op.drop_index(op.f("ix_role_version_end_transaction_id"), table_name="role_version")
|
||||
op.drop_table("role_version")
|
||||
|
||||
# user
|
||||
op.drop_index(op.f('ix_user_version_transaction_id'), table_name='user_version')
|
||||
op.drop_index(op.f('ix_user_version_operation_type'), table_name='user_version')
|
||||
op.drop_index(op.f('ix_user_version_end_transaction_id'), table_name='user_version')
|
||||
op.drop_table('user_version')
|
||||
op.drop_index(op.f("ix_user_version_transaction_id"), table_name="user_version")
|
||||
op.drop_index(op.f("ix_user_version_operation_type"), table_name="user_version")
|
||||
op.drop_index(op.f("ix_user_version_end_transaction_id"), table_name="user_version")
|
||||
op.drop_table("user_version")
|
||||
|
||||
# person
|
||||
op.drop_index(op.f('ix_person_version_transaction_id'), table_name='person_version')
|
||||
op.drop_index(op.f('ix_person_version_operation_type'), table_name='person_version')
|
||||
op.drop_index(op.f('ix_person_version_end_transaction_id'), table_name='person_version')
|
||||
op.drop_table('person_version')
|
||||
op.drop_index(op.f("ix_person_version_transaction_id"), table_name="person_version")
|
||||
op.drop_index(op.f("ix_person_version_operation_type"), table_name="person_version")
|
||||
op.drop_index(
|
||||
op.f("ix_person_version_end_transaction_id"), table_name="person_version"
|
||||
)
|
||||
op.drop_table("person_version")
|
||||
|
||||
# transaction
|
||||
op.drop_index(op.f('ix_transaction_user_id'), table_name='transaction')
|
||||
op.drop_table('transaction')
|
||||
op.drop_index(op.f("ix_transaction_user_id"), table_name="transaction")
|
||||
op.drop_table("transaction")
|
||||
|
|
10
tasks.py
10
tasks.py
|
@ -15,10 +15,10 @@ def release(c, skip_tests=False):
|
|||
Release a new version of Wutta-Continuum
|
||||
"""
|
||||
if not skip_tests:
|
||||
c.run('pytest')
|
||||
c.run("pytest")
|
||||
|
||||
if os.path.exists('dist'):
|
||||
shutil.rmtree('dist')
|
||||
if os.path.exists("dist"):
|
||||
shutil.rmtree("dist")
|
||||
|
||||
c.run('python -m build --sdist')
|
||||
c.run('twine upload dist/*')
|
||||
c.run("python -m build --sdist")
|
||||
c.run("twine upload dist/*")
|
||||
|
|
|
@ -17,5 +17,5 @@ class TestWuttaContinuumAppProvider(DataTestCase):
|
|||
self.assertFalse(provider.continuum_is_enabled())
|
||||
|
||||
# but can be turned on
|
||||
self.config.setdefault('wutta_continuum.enable_versioning', 'true')
|
||||
self.config.setdefault("wutta_continuum.enable_versioning", "true")
|
||||
self.assertTrue(provider.continuum_is_enabled())
|
||||
|
|
|
@ -17,8 +17,8 @@ class TestWuttaContinuumConfigExtension(DataTestCase):
|
|||
def test_startup(self):
|
||||
ext = self.make_extension()
|
||||
|
||||
with patch.object(mod, 'make_versioned') as make_versioned:
|
||||
with patch.object(mod, 'configure_mappers') as configure_mappers:
|
||||
with patch.object(mod, "make_versioned") as make_versioned:
|
||||
with patch.object(mod, "configure_mappers") as configure_mappers:
|
||||
|
||||
# nothing happens by default
|
||||
ext.startup(self.config)
|
||||
|
@ -26,7 +26,7 @@ class TestWuttaContinuumConfigExtension(DataTestCase):
|
|||
configure_mappers.assert_not_called()
|
||||
|
||||
# but will if we enable it in config
|
||||
self.config.setdefault('wutta_continuum.enable_versioning', 'true')
|
||||
self.config.setdefault("wutta_continuum.enable_versioning", "true")
|
||||
ext.startup(self.config)
|
||||
make_versioned.assert_called_once()
|
||||
configure_mappers.assert_called_once_with()
|
||||
|
@ -39,8 +39,8 @@ class TestWuttaContinuumPlugin(DataTestCase):
|
|||
|
||||
def test_remote_addr(self):
|
||||
plugin = self.make_plugin()
|
||||
with patch.object(socket, 'gethostbyname', return_value='127.0.0.1'):
|
||||
self.assertEqual(plugin.get_remote_addr(None, self.session), '127.0.0.1')
|
||||
with patch.object(socket, "gethostbyname", return_value="127.0.0.1"):
|
||||
self.assertEqual(plugin.get_remote_addr(None, self.session), "127.0.0.1")
|
||||
|
||||
def test_user_id(self):
|
||||
plugin = self.make_plugin()
|
||||
|
@ -48,11 +48,14 @@ class TestWuttaContinuumPlugin(DataTestCase):
|
|||
|
||||
def test_transaction_args(self):
|
||||
plugin = self.make_plugin()
|
||||
with patch.object(socket, 'gethostbyname', return_value='127.0.0.1'):
|
||||
self.assertEqual(plugin.transaction_args(None, self.session),
|
||||
{'remote_addr': '127.0.0.1'})
|
||||
with patch.object(socket, "gethostbyname", return_value="127.0.0.1"):
|
||||
self.assertEqual(
|
||||
plugin.transaction_args(None, self.session),
|
||||
{"remote_addr": "127.0.0.1"},
|
||||
)
|
||||
|
||||
with patch.object(plugin, 'get_user_id', return_value='some-random-uuid'):
|
||||
self.assertEqual(plugin.transaction_args(None, self.session),
|
||||
{'remote_addr': '127.0.0.1',
|
||||
'user_id': 'some-random-uuid'})
|
||||
with patch.object(plugin, "get_user_id", return_value="some-random-uuid"):
|
||||
self.assertEqual(
|
||||
plugin.transaction_args(None, self.session),
|
||||
{"remote_addr": "127.0.0.1", "user_id": "some-random-uuid"},
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue