summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mailman/database/alembic/__init__.py6
-rw-r--r--src/mailman/database/alembic/env.py12
-rw-r--r--src/mailman/database/alembic/versions/16c2b25c7b_list_subscription_policy.py25
-rw-r--r--src/mailman/database/alembic/versions/2bb9b382198_workflow_state_table.py13
-rw-r--r--src/mailman/database/alembic/versions/33bc0099223_add_member_indexes.py5
-rw-r--r--src/mailman/database/alembic/versions/33e1f5f6fa8_.py16
-rw-r--r--src/mailman/database/alembic/versions/3e09bb4a5dc_member_indexes.py7
-rw-r--r--src/mailman/database/alembic/versions/42756496720_header_matches.py9
-rw-r--r--src/mailman/database/alembic/versions/46e92facee7_add_serverowner_domainowner.py10
-rw-r--r--src/mailman/database/alembic/versions/47294d3a604_pendable_indexes.py9
-rw-r--r--src/mailman/database/alembic/versions/51b7f92bd06c_initial.py7
-rw-r--r--src/mailman/database/alembic/versions/70af5a4e5790_digests.py9
-rw-r--r--src/mailman/database/alembic/versions/781a38e146bf_mailinglist_indexes.py7
-rw-r--r--src/mailman/database/alembic/versions/bfda02ab3a9b_ban_indexes.py7
-rw-r--r--src/mailman/database/alembic/versions/d4fbb4fd34ca_header_match_order.py10
-rw-r--r--src/mailman/database/base.py8
-rw-r--r--src/mailman/database/factory.py15
-rw-r--r--src/mailman/database/helpers.py11
-rw-r--r--src/mailman/database/model.py11
-rw-r--r--src/mailman/database/postgresql.py12
-rw-r--r--src/mailman/database/sqlite.py13
-rw-r--r--src/mailman/database/tests/test_factory.py7
-rw-r--r--src/mailman/database/tests/test_migrations.py10
-rw-r--r--src/mailman/database/transaction.py17
-rw-r--r--src/mailman/database/types.py11
25 files changed, 111 insertions, 156 deletions
diff --git a/src/mailman/database/alembic/__init__.py b/src/mailman/database/alembic/__init__.py
index 1e8cf9c64..c9626cc9f 100644
--- a/src/mailman/database/alembic/__init__.py
+++ b/src/mailman/database/alembic/__init__.py
@@ -17,13 +17,9 @@
"""Alembic configuration initization."""
-__all__ = [
- 'alembic_cfg',
- ]
-
-
from alembic.config import Config
from mailman.utilities.modules import expand_path
alembic_cfg = Config(expand_path('python:mailman.config.alembic'))
+__all__ = ['alembic_cfg']
diff --git a/src/mailman/database/alembic/env.py b/src/mailman/database/alembic/env.py
index 0abc3df7b..7cda59e82 100644
--- a/src/mailman/database/alembic/env.py
+++ b/src/mailman/database/alembic/env.py
@@ -17,20 +17,16 @@
"""Alembic migration environment."""
-__all__ = [
- 'run_migrations_offline',
- 'run_migrations_online',
- ]
-
-
from alembic import context
from contextlib import closing
+from mailman import public
from mailman.core.initialize import initialize_1
from mailman.config import config
from mailman.database.model import Model
from mailman.utilities.string import expand
from sqlalchemy import create_engine
+
try:
url = expand(config.database.url, config.paths)
except AttributeError:
@@ -38,7 +34,8 @@ except AttributeError:
initialize_1()
url = expand(config.database.url, config.paths)
-
+
+@public
def run_migrations_offline():
"""Run migrations in 'offline' mode.
@@ -54,6 +51,7 @@ def run_migrations_offline():
context.run_migrations()
+@public
def run_migrations_online():
"""Run migrations in 'online' mode.
diff --git a/src/mailman/database/alembic/versions/16c2b25c7b_list_subscription_policy.py b/src/mailman/database/alembic/versions/16c2b25c7b_list_subscription_policy.py
index 16baf64b7..1358b99aa 100644
--- a/src/mailman/database/alembic/versions/16c2b25c7b_list_subscription_policy.py
+++ b/src/mailman/database/alembic/versions/16c2b25c7b_list_subscription_policy.py
@@ -6,10 +6,6 @@ Create Date: 2015-03-21 11:00:44.634883
"""
-# revision identifiers, used by Alembic.
-revision = '16c2b25c7b'
-down_revision = '46e92facee7'
-
from alembic import op
import sqlalchemy as sa
@@ -18,22 +14,27 @@ from mailman.database.helpers import is_sqlite, exists_in_db
from mailman.interfaces.mailinglist import SubscriptionPolicy
-def upgrade():
+# Revision identifiers, used by Alembic.
+revision = '16c2b25c7b'
+down_revision = '46e92facee7'
- ### Update the schema
+
+def upgrade():
+ # Update the schema.
if not exists_in_db(op.get_bind(), 'mailinglist', 'subscription_policy'):
# SQLite may not have removed it when downgrading.
op.add_column('mailinglist', sa.Column(
'subscription_policy', Enum(SubscriptionPolicy), nullable=True))
- ### Now migrate the data
- # don't import the table definition from the models, it may break this
- # migration when the model is updated in the future (see the Alembic doc)
- mlist = sa.sql.table('mailinglist',
+ # Now migrate the data. Don't import the table definition from the
+ # models, it may break this migration when the model is updated in the
+ # future (see the Alembic doc).
+ mlist = sa.sql.table(
+ 'mailinglist',
sa.sql.column('subscription_policy', Enum(SubscriptionPolicy))
)
- # there were no enforced subscription policy before, so all lists are
- # considered open
+ # There were no enforced subscription policy before, so all lists are
+ # considered open.
op.execute(mlist.update().values(
{'subscription_policy': op.inline_literal(SubscriptionPolicy.open)}))
diff --git a/src/mailman/database/alembic/versions/2bb9b382198_workflow_state_table.py b/src/mailman/database/alembic/versions/2bb9b382198_workflow_state_table.py
index 669733f5a..64def0253 100644
--- a/src/mailman/database/alembic/versions/2bb9b382198_workflow_state_table.py
+++ b/src/mailman/database/alembic/versions/2bb9b382198_workflow_state_table.py
@@ -6,16 +6,19 @@ Create Date: 2015-03-25 18:09:18.338790
"""
-# revision identifiers, used by Alembic.
-revision = '2bb9b382198'
-down_revision = '16c2b25c7b'
+import sqlalchemy as sa
from alembic import op
-import sqlalchemy as sa
+
+
+# Revision identifiers, used by Alembic.
+revision = '2bb9b382198'
+down_revision = '16c2b25c7b'
def upgrade():
- op.create_table('workflowstate',
+ op.create_table(
+ 'workflowstate',
sa.Column('name', sa.Unicode(), nullable=False),
sa.Column('token', sa.Unicode(), nullable=False),
sa.Column('step', sa.Unicode(), nullable=True),
diff --git a/src/mailman/database/alembic/versions/33bc0099223_add_member_indexes.py b/src/mailman/database/alembic/versions/33bc0099223_add_member_indexes.py
index beca161c6..ce8f2f3f1 100644
--- a/src/mailman/database/alembic/versions/33bc0099223_add_member_indexes.py
+++ b/src/mailman/database/alembic/versions/33bc0099223_add_member_indexes.py
@@ -6,12 +6,13 @@ Create Date: 2015-11-19 23:04:42.449553
"""
+from alembic import op
+
+
# Revision identifiers, used by Alembic.
revision = '33bc0099223'
down_revision = '42756496720'
-from alembic import op
-
def upgrade():
op.create_index(op.f('ix_member_address_id'),
diff --git a/src/mailman/database/alembic/versions/33e1f5f6fa8_.py b/src/mailman/database/alembic/versions/33e1f5f6fa8_.py
index 8bc645e06..a8b572518 100644
--- a/src/mailman/database/alembic/versions/33e1f5f6fa8_.py
+++ b/src/mailman/database/alembic/versions/33e1f5f6fa8_.py
@@ -25,18 +25,13 @@ Create Date: 2015-01-20 17:32:30.144083
"""
-__all__ = [
- 'downgrade',
- 'upgrade',
- ]
-
+import sqlalchemy as sa
from alembic import op
-import sqlalchemy as sa
from mailman.database.helpers import is_sqlite
-# revision identifiers, used by Alembic.
+# Revision identifiers, used by Alembic.
revision = '33e1f5f6fa8'
down_revision = '51b7f92bd06c'
@@ -66,8 +61,9 @@ def downgrade():
if op.get_bind().dialect.name == 'postgresql':
# PostgreSQL needs the USING clause that Alembic does not support
# yet.
- op.execute(('ALTER TABLE "{table}" ALTER COLUMN "{column}" '
- 'TYPE BYTEA USING decode("{column}", \'UTF8\')').format(
- table=table, column=column))
+ op.execute(
+ ('ALTER TABLE "{table}" ALTER COLUMN "{column}" '
+ 'TYPE BYTEA USING decode("{column}", \'UTF8\')').format(
+ table=table, column=column))
else:
op.alter_column(table, column, type_=sa.LargeBinary)
diff --git a/src/mailman/database/alembic/versions/3e09bb4a5dc_member_indexes.py b/src/mailman/database/alembic/versions/3e09bb4a5dc_member_indexes.py
index 6c7778ec2..24fc6b9cb 100644
--- a/src/mailman/database/alembic/versions/3e09bb4a5dc_member_indexes.py
+++ b/src/mailman/database/alembic/versions/3e09bb4a5dc_member_indexes.py
@@ -6,12 +6,13 @@ Create Date: 2015-12-11 19:16:57.030395
"""
-# revision identifiers, used by Alembic.
+from alembic import op
+
+
+# Revision identifiers, used by Alembic.
revision = '3e09bb4a5dc'
down_revision = '33bc0099223'
-from alembic import op
-
def upgrade():
op.create_index(
diff --git a/src/mailman/database/alembic/versions/42756496720_header_matches.py b/src/mailman/database/alembic/versions/42756496720_header_matches.py
index 5e8db9756..d197d5959 100644
--- a/src/mailman/database/alembic/versions/42756496720_header_matches.py
+++ b/src/mailman/database/alembic/versions/42756496720_header_matches.py
@@ -6,16 +6,17 @@ Create Date: 2015-09-11 10:11:38.310315
"""
-# revision identifiers, used by Alembic.
-revision = '42756496720'
-down_revision = '2bb9b382198'
-
import sqlalchemy as sa
from alembic import op
from mailman.database.helpers import is_sqlite, exists_in_db
+# Revision identifiers, used by Alembic.
+revision = '42756496720'
+down_revision = '2bb9b382198'
+
+
def upgrade():
# Create the new table
header_match_table = op.create_table(
diff --git a/src/mailman/database/alembic/versions/46e92facee7_add_serverowner_domainowner.py b/src/mailman/database/alembic/versions/46e92facee7_add_serverowner_domainowner.py
index 0fe7e345c..01a08d7d2 100644
--- a/src/mailman/database/alembic/versions/46e92facee7_add_serverowner_domainowner.py
+++ b/src/mailman/database/alembic/versions/46e92facee7_add_serverowner_domainowner.py
@@ -23,15 +23,17 @@ Create Date: 2015-03-20 16:01:25.007242
"""
-# Revision identifiers, used by Alembic.
-revision = '46e92facee7'
-down_revision = '33e1f5f6fa8'
+import sqlalchemy as sa
from alembic import op
-import sqlalchemy as sa
from mailman.database.helpers import is_sqlite, exists_in_db
+# Revision identifiers, used by Alembic.
+revision = '46e92facee7'
+down_revision = '33e1f5f6fa8'
+
+
def upgrade():
op.create_table(
'domain_owner',
diff --git a/src/mailman/database/alembic/versions/47294d3a604_pendable_indexes.py b/src/mailman/database/alembic/versions/47294d3a604_pendable_indexes.py
index 6b627dc77..5e465af24 100644
--- a/src/mailman/database/alembic/versions/47294d3a604_pendable_indexes.py
+++ b/src/mailman/database/alembic/versions/47294d3a604_pendable_indexes.py
@@ -9,16 +9,17 @@ Create Date: 2015-12-02 11:46:47.295174
"""
-# revision identifiers, used by Alembic.
-revision = '47294d3a604'
-down_revision = '3e09bb4a5dc'
-
import json
import sqlalchemy as sa
from alembic import op
+# revision identifiers, used by Alembic.
+revision = '47294d3a604'
+down_revision = '3e09bb4a5dc'
+
+
TYPE_CLUES = {
'member_id': 'probe',
'token_owner': 'subscription',
diff --git a/src/mailman/database/alembic/versions/51b7f92bd06c_initial.py b/src/mailman/database/alembic/versions/51b7f92bd06c_initial.py
index bb14a98a0..6252e1f23 100644
--- a/src/mailman/database/alembic/versions/51b7f92bd06c_initial.py
+++ b/src/mailman/database/alembic/versions/51b7f92bd06c_initial.py
@@ -29,13 +29,8 @@ Revises: None
Create Date: 2014-10-10 09:53:35.624472
"""
-__all__ = [
- 'downgrade',
- 'upgrade',
- ]
-
-
import sqlalchemy as sa
+
from alembic import op
from mailman.database.helpers import is_sqlite, exists_in_db
diff --git a/src/mailman/database/alembic/versions/70af5a4e5790_digests.py b/src/mailman/database/alembic/versions/70af5a4e5790_digests.py
index 9a03678fe..50c87ccf3 100644
--- a/src/mailman/database/alembic/versions/70af5a4e5790_digests.py
+++ b/src/mailman/database/alembic/versions/70af5a4e5790_digests.py
@@ -6,10 +6,6 @@ Create Date: 2015-12-19 12:05:42.202998
"""
-# revision identifiers, used by Alembic.
-revision = '70af5a4e5790'
-down_revision = '47294d3a604'
-
import os
import sqlalchemy as sa
@@ -17,6 +13,11 @@ from alembic import op
from mailman.config import config
+# Revision identifiers, used by Alembic.
+revision = '70af5a4e5790'
+down_revision = '47294d3a604'
+
+
def upgrade():
with op.batch_alter_table('mailinglist') as batch_op:
batch_op.alter_column('digestable', new_column_name='digests_enabled')
diff --git a/src/mailman/database/alembic/versions/781a38e146bf_mailinglist_indexes.py b/src/mailman/database/alembic/versions/781a38e146bf_mailinglist_indexes.py
index c375fea1c..cc0900621 100644
--- a/src/mailman/database/alembic/versions/781a38e146bf_mailinglist_indexes.py
+++ b/src/mailman/database/alembic/versions/781a38e146bf_mailinglist_indexes.py
@@ -6,12 +6,13 @@ Create Date: 2016-01-14 15:34:29.734429
"""
-# revision identifiers, used by Alembic.
+from alembic import op
+
+
+# Revision identifiers, used by Alembic.
revision = '781a38e146bf'
down_revision = '70af5a4e5790'
-from alembic import op
-
def upgrade():
op.create_index(
diff --git a/src/mailman/database/alembic/versions/bfda02ab3a9b_ban_indexes.py b/src/mailman/database/alembic/versions/bfda02ab3a9b_ban_indexes.py
index 952b9eeaf..1064db470 100644
--- a/src/mailman/database/alembic/versions/bfda02ab3a9b_ban_indexes.py
+++ b/src/mailman/database/alembic/versions/bfda02ab3a9b_ban_indexes.py
@@ -6,12 +6,13 @@ Create Date: 2016-01-14 16:15:44.059688
"""
-# revision identifiers, used by Alembic.
+from alembic import op
+
+
+# Revision identifiers, used by Alembic.
revision = 'bfda02ab3a9b'
down_revision = '781a38e146bf'
-from alembic import op
-
def upgrade():
op.create_index(op.f('ix_ban_email'), 'ban', ['email'], unique=False)
diff --git a/src/mailman/database/alembic/versions/d4fbb4fd34ca_header_match_order.py b/src/mailman/database/alembic/versions/d4fbb4fd34ca_header_match_order.py
index 66ffb0169..2608bb812 100644
--- a/src/mailman/database/alembic/versions/d4fbb4fd34ca_header_match_order.py
+++ b/src/mailman/database/alembic/versions/d4fbb4fd34ca_header_match_order.py
@@ -6,14 +6,16 @@ Create Date: 2016-02-01 15:57:09.807678
"""
-# revision identifiers, used by Alembic.
-revision = 'd4fbb4fd34ca'
-down_revision = 'bfda02ab3a9b'
-
import sqlalchemy as sa
+
from alembic import op
+# Revision identifiers, used by Alembic.
+revision = 'd4fbb4fd34ca'
+down_revision = 'bfda02ab3a9b'
+
+
def upgrade():
with op.batch_alter_table('headermatch') as batch_op:
batch_op.add_column(
diff --git a/src/mailman/database/base.py b/src/mailman/database/base.py
index 2acc4d897..5cc582e56 100644
--- a/src/mailman/database/base.py
+++ b/src/mailman/database/base.py
@@ -17,13 +17,9 @@
"""Common database support."""
-__all__ = [
- 'SABaseDatabase',
- ]
-
-
import logging
+from mailman import public
from mailman.config import config
from mailman.interfaces.database import IDatabase
from mailman.utilities.string import expand
@@ -35,7 +31,7 @@ from zope.interface import implementer
log = logging.getLogger('mailman.database')
-
+@public
@implementer(IDatabase)
class SABaseDatabase:
"""The database base class for use with SQLAlchemy.
diff --git a/src/mailman/database/factory.py b/src/mailman/database/factory.py
index afacfdfb7..ff7fa59a9 100644
--- a/src/mailman/database/factory.py
+++ b/src/mailman/database/factory.py
@@ -17,12 +17,6 @@
"""Database factory."""
-__all__ = [
- 'DatabaseFactory',
- 'DatabaseTestingFactory',
- ]
-
-
import os
import types
import alembic.command
@@ -30,6 +24,7 @@ import alembic.command
from alembic.migration import MigrationContext
from alembic.script import ScriptDirectory
from flufl.lock import Lock
+from mailman import public
from mailman.config import config
from mailman.database.alembic import alembic_cfg
from mailman.database.model import Model
@@ -44,7 +39,7 @@ from zope.interface.verify import verifyObject
LAST_STORM_SCHEMA_VERSION = '20130406000000'
-
+@public
@implementer(IDatabaseFactory)
class DatabaseFactory:
"""Create a new database."""
@@ -62,7 +57,7 @@ class DatabaseFactory:
return database
-
+@public
class SchemaManager:
"Manage schema migrations."""
@@ -89,7 +84,7 @@ class SchemaManager:
current_rev = context.get_current_revision()
head_rev = self._script.get_current_head()
if current_rev == head_rev:
- # We're already at the latest revision so there's nothing to do.
+ # We're already at the latest revision so there's nothing to do.
return head_rev
if current_rev is None:
# No Alembic information is available.
@@ -112,7 +107,6 @@ class SchemaManager:
return head_rev
-
def _reset(self):
"""See `IDatabase`."""
# Avoid a circular import at module level.
@@ -124,6 +118,7 @@ def _reset(self):
self.store.commit()
+@public
@implementer(IDatabaseFactory)
class DatabaseTestingFactory:
"""Create a new database for testing."""
diff --git a/src/mailman/database/helpers.py b/src/mailman/database/helpers.py
index 7ce3d3f43..f58d559c5 100644
--- a/src/mailman/database/helpers.py
+++ b/src/mailman/database/helpers.py
@@ -17,20 +17,17 @@
"""Common database helpers."""
-__all__ = [
- 'exists_in_db',
- 'is_sqlite',
- ]
-
-
import sqlalchemy as sa
+from mailman import public
+
-
+@public
def is_sqlite(bind):
return bind.dialect.name == 'sqlite'
+@public
def exists_in_db(bind, tablename, columnname=None):
md = sa.MetaData()
md.reflect(bind=bind)
diff --git a/src/mailman/database/model.py b/src/mailman/database/model.py
index 216785d1e..b9ba54c8d 100644
--- a/src/mailman/database/model.py
+++ b/src/mailman/database/model.py
@@ -17,13 +17,7 @@
"""Base class for all database classes."""
-__all__ = [
- 'Model',
- ]
-
-
-import contextlib
-
+from contextlib import closing
from mailman.config import config
from sqlalchemy.ext.declarative import declarative_base
@@ -37,7 +31,7 @@ class ModelMeta:
"""
@staticmethod
def _reset(db):
- with contextlib.closing(config.db.engine.connect()) as connection:
+ with closing(config.db.engine.connect()) as connection:
transaction = connection.begin()
try:
# Delete all the tables in reverse foreign key dependency
@@ -52,3 +46,4 @@ class ModelMeta:
Model = declarative_base(cls=ModelMeta)
+__all__ = ['Model']
diff --git a/src/mailman/database/postgresql.py b/src/mailman/database/postgresql.py
index a83119f66..a09ee3038 100644
--- a/src/mailman/database/postgresql.py
+++ b/src/mailman/database/postgresql.py
@@ -17,17 +17,13 @@
"""PostgreSQL database support."""
-__all__ = [
- 'PostgreSQLDatabase',
- ]
-
-
+from mailman import public
from mailman.database.base import SABaseDatabase
from mailman.database.model import Model
from sqlalchemy import Integer
-
+@public
class PostgreSQLDatabase(SABaseDatabase):
"""Database class for PostgreSQL."""
@@ -45,8 +41,8 @@ class PostgreSQLDatabase(SABaseDatabase):
for table in tables:
for column in table.primary_key:
if (column.autoincrement
- and isinstance(column.type, Integer)
- and not column.foreign_keys):
+ and isinstance(column.type, Integer) # flake8: noqa
+ and not column.foreign_keys): # flake8: noqa
store.execute("""\
SELECT setval('"{0}_{1}_seq"', coalesce(max("{1}"), 1),
max("{1}") IS NOT null)
diff --git a/src/mailman/database/sqlite.py b/src/mailman/database/sqlite.py
index fd90593fb..e36b2ba75 100644
--- a/src/mailman/database/sqlite.py
+++ b/src/mailman/database/sqlite.py
@@ -17,18 +17,14 @@
"""SQLite database support."""
-__all__ = [
- 'SQLiteDatabase',
- ]
-
-
import os
+from mailman import public
from mailman.database.base import SABaseDatabase
from urllib.parse import urlparse
-
+@public
class SQLiteDatabase(SABaseDatabase):
"""Database class for SQLite."""
@@ -39,7 +35,10 @@ class SQLiteDatabase(SABaseDatabase):
# Ensure that the SQLite database file has the proper permissions,
# since SQLite doesn't play nice with umask.
path = os.path.normpath(parts.path)
- fd = os.open(path, os.O_WRONLY | os.O_NONBLOCK | os.O_CREAT, 0o666)
+ fd = os.open(
+ path,
+ os.O_WRONLY | os.O_NONBLOCK | os.O_CREAT, # flake8: noqa
+ 0o666)
# Ignore errors
if fd > 0:
os.close(fd)
diff --git a/src/mailman/database/tests/test_factory.py b/src/mailman/database/tests/test_factory.py
index 12339d643..0c2e595c9 100644
--- a/src/mailman/database/tests/test_factory.py
+++ b/src/mailman/database/tests/test_factory.py
@@ -17,11 +17,6 @@
"""Test database schema migrations"""
-__all__ = [
- 'TestSchemaManager',
- ]
-
-
import unittest
import alembic.command
@@ -37,9 +32,7 @@ from sqlalchemy.schema import Index
from unittest.mock import patch
-
class TestSchemaManager(unittest.TestCase):
-
layer = ConfigLayer
def setUp(self):
diff --git a/src/mailman/database/tests/test_migrations.py b/src/mailman/database/tests/test_migrations.py
index 331f386d0..3087c46ee 100644
--- a/src/mailman/database/tests/test_migrations.py
+++ b/src/mailman/database/tests/test_migrations.py
@@ -17,11 +17,6 @@
"""Test database schema migrations with Alembic"""
-__all__ = [
- 'TestMigrations',
- ]
-
-
import os
import unittest
import alembic.command
@@ -102,7 +97,8 @@ class TestMigrations(unittest.TestCase):
alembic.command.upgrade(alembic_cfg, '42756496720')
results = config.db.store.execute(
header_match_table.select()).fetchall()
- self.assertEqual(results,
+ self.assertEqual(
+ results,
[(1, hm[0], hm[1]) for hm in test_header_matches])
def test_47294d3a604_pendable_keyvalues(self):
@@ -127,7 +123,7 @@ class TestMigrations(unittest.TestCase):
sa.sql.column('value', sa.Unicode),
sa.sql.column('pended_id', sa.Integer),
)
- def get_from_db():
+ def get_from_db(): # flake8: noqa
results = {}
for i in range(1, 6):
query = sa.sql.select(
diff --git a/src/mailman/database/transaction.py b/src/mailman/database/transaction.py
index 27a3564a3..09dfda8e3 100644
--- a/src/mailman/database/transaction.py
+++ b/src/mailman/database/transaction.py
@@ -17,19 +17,12 @@
"""Transactional support."""
-__all__ = [
- 'dbconnection',
- 'flush',
- 'transaction',
- 'transactional',
- ]
-
-
from contextlib import contextmanager
+from mailman import public
from mailman.config import config
-
+@public
@contextmanager
def transaction():
"""Context manager for ensuring the transaction is complete."""
@@ -42,7 +35,7 @@ def transaction():
config.db.commit()
-
+@public
def transactional(function):
"""Decorator for transactional support.
@@ -63,7 +56,7 @@ def transactional(function):
return wrapper
-
+@public
@contextmanager
def flush():
"""Context manager for flushing SQLAlchemy.
@@ -79,7 +72,7 @@ def flush():
config.db.store.flush()
-
+@public
def dbconnection(function):
"""Decorator for getting at the database connection.
diff --git a/src/mailman/database/types.py b/src/mailman/database/types.py
index 66fbbf9e9..343ee0461 100644
--- a/src/mailman/database/types.py
+++ b/src/mailman/database/types.py
@@ -17,20 +17,15 @@
"""Database type conversions."""
-__all__ = [
- 'Enum',
- 'UUID',
- ]
-
-
import uuid
+from mailman import public
from sqlalchemy import Integer
from sqlalchemy.dialects import postgresql
from sqlalchemy.types import TypeDecorator, CHAR
-
+@public
class Enum(TypeDecorator):
"""Handle Python 3.4 style enums.
@@ -54,7 +49,7 @@ class Enum(TypeDecorator):
return self.enum(value)
-
+@public
class UUID(TypeDecorator):
"""Platform-independent GUID type.