summaryrefslogtreecommitdiff
path: root/src/mailman/database/base.py
diff options
context:
space:
mode:
authorBarry Warsaw2014-09-22 14:47:02 -0400
committerBarry Warsaw2014-09-22 14:47:02 -0400
commit6b3114c4f0d458db25aa68dc44deeaca5b642ac4 (patch)
tree5ba5344e3186dbc3b0f31da6bf9f23bccb7ace4c /src/mailman/database/base.py
parentf582dbfd193f15aa840228fa4b1c2544ae379a8e (diff)
downloadmailman-6b3114c4f0d458db25aa68dc44deeaca5b642ac4.tar.gz
mailman-6b3114c4f0d458db25aa68dc44deeaca5b642ac4.tar.zst
mailman-6b3114c4f0d458db25aa68dc44deeaca5b642ac4.zip
Diffstat (limited to 'src/mailman/database/base.py')
-rw-r--r--src/mailman/database/base.py25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/mailman/database/base.py b/src/mailman/database/base.py
index f379b3124..8c426f8cf 100644
--- a/src/mailman/database/base.py
+++ b/src/mailman/database/base.py
@@ -19,28 +19,22 @@ from __future__ import absolute_import, print_function, unicode_literals
__metaclass__ = type
__all__ = [
- 'StormBaseDatabase',
+ 'SABaseDatabase',
]
-import os
-import sys
import logging
-from lazr.config import as_boolean
-from pkg_resources import resource_listdir, resource_string
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
-from sqlalchemy.orm.session import Session
from zope.interface import implementer
from mailman.config import config
from mailman.interfaces.database import IDatabase
-from mailman.model.version import Version
from mailman.utilities.string import expand
-log = logging.getLogger('mailman.config')
+log = logging.getLogger('mailman.config')
NL = '\n'
@@ -53,17 +47,15 @@ class SABaseDatabase:
"""
# Tag used to distinguish the database being used. Override this in base
# classes.
-
TAG = ''
def __init__(self):
self.url = None
self.store = None
- self.transaction = None
def begin(self):
"""See `IDatabase`."""
- # SA does this for us.
+ # SQLAlchemy does this for us.
pass
def commit(self):
@@ -102,9 +94,13 @@ class SABaseDatabase:
"""
pass
+ # XXX Abhilash removed teh _prepare() method. Is that because SA takes
+ # care of this for us? If so, then the comment below must be updated.
+ # For reference, the SQLite bug is marked "won't fix".
+
def initialize(self, debug=None):
- """See `IDatabase`"""
- # Calculate the engine url
+ """See `IDatabase`."""
+ # Calculate the engine url.
url = expand(config.database.url, config.paths)
log.debug('Database url: %s', url)
# XXX By design of SQLite, database file creation does not honor
@@ -127,6 +123,9 @@ class SABaseDatabase:
self.store = session()
self.store.commit()
+ # XXX We should probably rename load_migrations() and perhaps get rid of
+ # load_sql(). The latter is never called any more.
+
def load_migrations(self, until=None):
"""Load schema migrations.