summaryrefslogtreecommitdiff
path: root/src/mailman/config
diff options
context:
space:
mode:
authorBarry Warsaw2014-09-27 18:16:22 -0400
committerBarry Warsaw2014-09-27 18:16:22 -0400
commitb3500aefb15c63ccf60ab4508868f770ffd2d309 (patch)
tree049e083e3ce28e7e504c1945f0dd8e2cf09dd40b /src/mailman/config
parenteef73255db608785a55c055cbbfb800603671ff6 (diff)
parent03647b16eb75cc841bb15c3c48ac5f18f77118b8 (diff)
downloadmailman-b3500aefb15c63ccf60ab4508868f770ffd2d309.tar.gz
mailman-b3500aefb15c63ccf60ab4508868f770ffd2d309.tar.zst
mailman-b3500aefb15c63ccf60ab4508868f770ffd2d309.zip
Migrations, with cleanup by Barry.
Diffstat (limited to 'src/mailman/config')
-rw-r--r--src/mailman/config/alembic.ini57
-rw-r--r--src/mailman/config/config.py11
-rw-r--r--src/mailman/config/schema.cfg6
3 files changed, 64 insertions, 10 deletions
diff --git a/src/mailman/config/alembic.ini b/src/mailman/config/alembic.ini
new file mode 100644
index 000000000..a7247743c
--- /dev/null
+++ b/src/mailman/config/alembic.ini
@@ -0,0 +1,57 @@
+# A generic, single database configuration.
+
+[alembic]
+# path to migration scripts
+script_location = src/mailman/database/alembic
+
+# template used to generate migration files
+# file_template = %%(rev)s_%%(slug)s
+
+# max length of characters to apply to the
+# "slug" field
+#truncate_slug_length = 40
+
+# set to 'true' to run the environment during
+# the 'revision' command, regardless of autogenerate
+# revision_environment = false
+
+# set to 'true' to allow .pyc and .pyo files without
+# a source .py file to be detected as revisions in the
+# versions/ directory
+# sourceless = false
+
+
+# Logging configuration
+[loggers]
+keys = root,sqlalchemy,alembic
+
+[handlers]
+keys = console
+
+[formatters]
+keys = generic
+
+[logger_root]
+level = WARN
+handlers = console
+qualname =
+
+[logger_sqlalchemy]
+level = WARN
+handlers =
+qualname = sqlalchemy.engine
+
+[logger_alembic]
+level = INFO
+handlers =
+qualname = alembic
+
+[handler_console]
+class = StreamHandler
+args = (sys.stderr,)
+level = NOTSET
+formatter = generic
+
+[formatter_generic]
+format = %(levelname)-5.5s [%(name)s] %(message)s
+datefmt = %H:%M:%S
diff --git a/src/mailman/config/config.py b/src/mailman/config/config.py
index e8c8ebc8b..52cac414f 100644
--- a/src/mailman/config/config.py
+++ b/src/mailman/config/config.py
@@ -33,7 +33,7 @@ import sys
from ConfigParser import SafeConfigParser
from flufl.lock import Lock
from lazr.config import ConfigSchema, as_boolean
-from pkg_resources import resource_filename, resource_stream, resource_string
+from pkg_resources import resource_stream, resource_string
from string import Template
from zope.component import getUtility
from zope.event import notify
@@ -46,7 +46,7 @@ from mailman.interfaces.configuration import (
ConfigurationUpdatedEvent, IConfiguration, MissingConfigurationFileError)
from mailman.interfaces.languages import ILanguageManager
from mailman.utilities.filesystem import makedirs
-from mailman.utilities.modules import call_name
+from mailman.utilities.modules import call_name, expand_path
SPACE = ' '
@@ -304,12 +304,7 @@ def external_configuration(path):
:return: A `ConfigParser` instance.
"""
# Is the context coming from a file system or Python path?
- if path.startswith('python:'):
- resource_path = path[7:]
- package, dot, resource = resource_path.rpartition('.')
- cfg_path = resource_filename(package, resource + '.cfg')
- else:
- cfg_path = path
+ cfg_path = expand_path(path)
parser = SafeConfigParser()
files = parser.read(cfg_path)
if files != [cfg_path]:
diff --git a/src/mailman/config/schema.cfg b/src/mailman/config/schema.cfg
index d7508a533..3ed7d72da 100644
--- a/src/mailman/config/schema.cfg
+++ b/src/mailman/config/schema.cfg
@@ -204,8 +204,10 @@ class: mailman.database.sqlite.SQLiteDatabase
url: sqlite:///$DATA_DIR/mailman.db
debug: no
-# The module path to the migrations modules.
-migrations_path: mailman.database.schema
+# Where can we find the Alembic migration scripts? The `python:` schema means
+# that this is a module path relative to the Mailman 3 source installation.
+alembic_scripts: python:mailman.database.alembic
+
[logging.template]
# This defines various log settings. The options available are: