diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/mailman/bin/tests/test_master.py | 2 | ||||
| -rw-r--r-- | src/mailman/config/schema.cfg | 4 | ||||
| -rw-r--r-- | src/mailman/core/logging.py | 10 | ||||
| -rw-r--r-- | src/mailman/database/base.py | 2 | ||||
| -rw-r--r-- | src/mailman/database/model.py | 3 | ||||
| -rw-r--r-- | src/mailman/docs/ACKNOWLEDGMENTS.rst | 1 | ||||
| -rw-r--r-- | src/mailman/docs/NEWS.rst | 20 | ||||
| -rw-r--r-- | src/mailman/interfaces/database.py | 4 | ||||
| -rw-r--r-- | src/mailman/interfaces/domain.py | 3 | ||||
| -rw-r--r-- | src/mailman/interfaces/listmanager.py | 3 | ||||
| -rw-r--r-- | src/mailman/model/address.py | 3 | ||||
| -rw-r--r-- | src/mailman/model/autorespond.py | 3 | ||||
| -rw-r--r-- | src/mailman/model/mailinglist.py | 3 | ||||
| -rw-r--r-- | src/mailman/model/roster.py | 10 | ||||
| -rw-r--r-- | src/mailman/testing/layers.py | 2 | ||||
| -rw-r--r-- | src/mailman/testing/testing.cfg | 6 |
16 files changed, 45 insertions, 34 deletions
diff --git a/src/mailman/bin/tests/test_master.py b/src/mailman/bin/tests/test_master.py index 269edaa23..d6e301e58 100644 --- a/src/mailman/bin/tests/test_master.py +++ b/src/mailman/bin/tests/test_master.py @@ -21,6 +21,7 @@ from __future__ import absolute_import, print_function, unicode_literals __metaclass__ = type __all__ = [ + 'TestMasterLock', ] @@ -30,7 +31,6 @@ import tempfile import unittest from flufl.lock import Lock - from mailman.bin import master diff --git a/src/mailman/config/schema.cfg b/src/mailman/config/schema.cfg index fa7624a81..ef158d6c5 100644 --- a/src/mailman/config/schema.cfg +++ b/src/mailman/config/schema.cfg @@ -254,6 +254,7 @@ path: bounce.log [logging.config] [logging.database] +level: warn [logging.debug] path: debug.log @@ -304,9 +305,6 @@ failure: $msgid delivery to $recip failed with code $smtpcode, $smtpmsg [logging.vette] -[logging.database] -level: warn - [webservice] # The hostname at which admin web service resources are exposed. diff --git a/src/mailman/core/logging.py b/src/mailman/core/logging.py index f4b9a1da1..c9285af92 100644 --- a/src/mailman/core/logging.py +++ b/src/mailman/core/logging.py @@ -32,7 +32,6 @@ import codecs import logging from lazr.config import as_boolean, as_log_level - from mailman.config import config @@ -42,8 +41,7 @@ _handlers = {} # XXX I would love to simplify things and use Python's WatchedFileHandler, but # there are two problems. First, it's more difficult to handle the test -# suite's need to reopen the file handler to a different path. Does -# zope.testing's logger support fix this? +# suite's need to reopen the file handler to a different path. # # The other problem is that WatchedFileHandler doesn't really easily support # HUPing the process to reopen the log file. Now, maybe that's not a big deal @@ -149,9 +147,9 @@ def initialize(propagate=None): log = logging.getLogger('flufl.lock') if sub_name == 'database': # Set both the SQLAlchemy and Alembic logs to the mailman.database - # log configuration, essentially ignoring the alembic.cfg - # settings. Do the SQLAlchemy one first, then let the Alembic one - # fall through to the common code path. + # log configuration, essentially ignoring the alembic.cfg settings. + # Do the SQLAlchemy one first, then let the Alembic one fall + # through to the common code path. log = logging.getLogger('sqlalchemy') _init_logger(propagate, sub_name, log, logger_config) log = logging.getLogger('alembic') diff --git a/src/mailman/database/base.py b/src/mailman/database/base.py index beb9c260d..2b86899bc 100644 --- a/src/mailman/database/base.py +++ b/src/mailman/database/base.py @@ -34,7 +34,7 @@ from mailman.interfaces.database import IDatabase from mailman.utilities.string import expand -log = logging.getLogger('mailman.config') +log = logging.getLogger('mailman.database') NL = '\n' diff --git a/src/mailman/database/model.py b/src/mailman/database/model.py index b65d7d5eb..a6056bf63 100644 --- a/src/mailman/database/model.py +++ b/src/mailman/database/model.py @@ -27,9 +27,8 @@ __all__ = [ import contextlib -from sqlalchemy.ext.declarative import declarative_base - from mailman.config import config +from sqlalchemy.ext.declarative import declarative_base class ModelMeta: diff --git a/src/mailman/docs/ACKNOWLEDGMENTS.rst b/src/mailman/docs/ACKNOWLEDGMENTS.rst index 8e6987265..5b68d6931 100644 --- a/src/mailman/docs/ACKNOWLEDGMENTS.rst +++ b/src/mailman/docs/ACKNOWLEDGMENTS.rst @@ -225,6 +225,7 @@ left off the list! * Don Porter * Francesco Potortì * Bob Puff +* Abhilash Raj * Michael Ranner * John Read * Sean Reifschneider diff --git a/src/mailman/docs/NEWS.rst b/src/mailman/docs/NEWS.rst index c71dbb592..3153a1fa0 100644 --- a/src/mailman/docs/NEWS.rst +++ b/src/mailman/docs/NEWS.rst @@ -12,6 +12,26 @@ Here is a history of user visible changes to Mailman. ==================================== (2014-XX-XX) +Database +-------- + * The ORM layer, previously implemented with Storm, has been replaced by + SQLAlchemy, thanks to the fantastic work by Abhilash Raj and Aurélien + Bompard. Alembic is now used for all database schema migrations. + * The new logger `mailman.database` logs any errors at the database layer. + +API +--- + * Several changes to the internal API: + - `IListManager.mailing_lists` is guaranteed to be sorted in List-ID order. + - `IDomains.mailing_lists` is guaranteed to be sorted in List-ID order. + - Iteration over domains via the `IDomainManager` is guaranteed to be sorted + by `IDomain.mail_host` order. + - `ITemporaryDatabase` interface and all implementations are removed. + +Configuration +------------- + * The ``[database]migrations_path`` setting is removed. + 3.0 beta 4 -- "Time and Motion" =============================== diff --git a/src/mailman/interfaces/database.py b/src/mailman/interfaces/database.py index bd436ed13..9ca05b747 100644 --- a/src/mailman/interfaces/database.py +++ b/src/mailman/interfaces/database.py @@ -27,12 +27,10 @@ __all__ = [ ] -from zope.interface import Attribute, Interface - from mailman.interfaces.errors import MailmanError +from zope.interface import Attribute, Interface - class DatabaseError(MailmanError): """A problem with the database occurred.""" diff --git a/src/mailman/interfaces/domain.py b/src/mailman/interfaces/domain.py index d51b1a702..a4f929ddb 100644 --- a/src/mailman/interfaces/domain.py +++ b/src/mailman/interfaces/domain.py @@ -31,9 +31,8 @@ __all__ = [ ] -from zope.interface import Interface, Attribute - from mailman.core.errors import MailmanError +from zope.interface import Interface, Attribute diff --git a/src/mailman/interfaces/listmanager.py b/src/mailman/interfaces/listmanager.py index 0c641fb91..7fe8ed35a 100644 --- a/src/mailman/interfaces/listmanager.py +++ b/src/mailman/interfaces/listmanager.py @@ -31,9 +31,8 @@ __all__ = [ ] -from zope.interface import Interface, Attribute - from mailman.interfaces.errors import MailmanError +from zope.interface import Interface, Attribute diff --git a/src/mailman/model/address.py b/src/mailman/model/address.py index cc4ab6fd0..5d1994567 100644 --- a/src/mailman/model/address.py +++ b/src/mailman/model/address.py @@ -26,8 +26,7 @@ __all__ = [ from email.utils import formataddr -from sqlalchemy import ( - Column, DateTime, ForeignKey, Integer, Unicode) +from sqlalchemy import Column, DateTime, ForeignKey, Integer, Unicode from sqlalchemy.orm import relationship, backref from zope.component import getUtility from zope.event import notify diff --git a/src/mailman/model/autorespond.py b/src/mailman/model/autorespond.py index 2293f5dcd..cfb9e017d 100644 --- a/src/mailman/model/autorespond.py +++ b/src/mailman/model/autorespond.py @@ -26,8 +26,7 @@ __all__ = [ ] -from sqlalchemy import Column, Date, ForeignKey, Integer -from sqlalchemy import desc +from sqlalchemy import Column, Date, ForeignKey, Integer, desc from sqlalchemy.orm import relationship from zope.interface import implementer diff --git a/src/mailman/model/mailinglist.py b/src/mailman/model/mailinglist.py index 4792c3f48..761a78b94 100644 --- a/src/mailman/model/mailinglist.py +++ b/src/mailman/model/mailinglist.py @@ -460,8 +460,7 @@ class MailingList(Model): elif role is MemberRole.moderator: return self.moderators else: - raise TypeError( - 'Undefined MemberRole: {0}'.format(role)) + raise TypeError('Undefined MemberRole: {}'.format(role)) @dbconnection def subscribe(self, store, subscriber, role=MemberRole.member): diff --git a/src/mailman/model/roster.py b/src/mailman/model/roster.py index a6cbeb104..54bc11617 100644 --- a/src/mailman/model/roster.py +++ b/src/mailman/model/roster.py @@ -167,11 +167,11 @@ class AdministratorRoster(AbstractRoster): def get_member(self, store, address): """See `IRoster`.""" results = store.query(Member).filter( - Member.list_id == self._mlist.list_id, - or_(Member.role == MemberRole.moderator, - Member.role == MemberRole.owner), - Address.email == address, - Member.address_id == Address.id) + Member.list_id == self._mlist.list_id, + or_(Member.role == MemberRole.moderator, + Member.role == MemberRole.owner), + Address.email == address, + Member.address_id == Address.id) if results.count() == 0: return None elif results.count() == 1: diff --git a/src/mailman/testing/layers.py b/src/mailman/testing/layers.py index 6104e64f7..006feef9c 100644 --- a/src/mailman/testing/layers.py +++ b/src/mailman/testing/layers.py @@ -194,6 +194,8 @@ class ConfigLayer(MockAndMonkeyLayer): # Destroy the test database after the tests are done so that there is # no data in case the tests are rerun with a database layer like mysql # or postgresql which are not deleted in teardown. + # + # XXX 2014-11-01 BAW: Shouldn't reset_the_world() take care of this? config.db.destroy() config.pop('test config') shutil.rmtree(cls.var_dir) diff --git a/src/mailman/testing/testing.cfg b/src/mailman/testing/testing.cfg index b61b36604..12646c680 100644 --- a/src/mailman/testing/testing.cfg +++ b/src/mailman/testing/testing.cfg @@ -18,9 +18,9 @@ # A testing configuration. # For testing against PostgreSQL. -#[database] -#class: mailman.database.postgresql.PostgreSQLDatabase -#url: postgresql://barry:barry@localhost:5432/mailman +[database] +class: mailman.database.postgresql.PostgreSQLDatabase +url: postgresql://barry:barry@localhost:5432/mailman [mailman] site_owner: noreply@example.com |
