summaryrefslogtreecommitdiff
path: root/mailman/database
diff options
context:
space:
mode:
authorBarry Warsaw2009-01-01 17:58:39 -0500
committerBarry Warsaw2009-01-01 17:58:39 -0500
commit1c285f110d8e98597453c6b4b69ea01163033547 (patch)
tree00c7ec16711b2073e40f593658f652726a9d4231 /mailman/database
parent12513c7d0fc1f5d2a1aabda349637309f6e8300b (diff)
parent600ddb503a391d70230d96ee91a631888d11b35a (diff)
downloadmailman-1c285f110d8e98597453c6b4b69ea01163033547.tar.gz
mailman-1c285f110d8e98597453c6b4b69ea01163033547.tar.zst
mailman-1c285f110d8e98597453c6b4b69ea01163033547.zip
Two major structural conversions.
* Use zc.buildout and zc.testing frameworks for building and testing Mailman. * Use lazr.config as the configuration system, though this conversion is not yet complete. Also: move a bunch of old bin scripts to the attic.
Diffstat (limited to 'mailman/database')
-rw-r--r--mailman/database/__init__.py16
-rw-r--r--mailman/database/address.py4
-rw-r--r--mailman/database/language.py2
-rw-r--r--mailman/database/listmanager.py4
-rw-r--r--mailman/database/mailinglist.py9
-rw-r--r--mailman/database/member.py4
-rw-r--r--mailman/database/message.py4
-rw-r--r--mailman/database/messagestore.py4
-rw-r--r--mailman/database/model.py2
-rw-r--r--mailman/database/pending.py7
-rw-r--r--mailman/database/preferences.py2
-rw-r--r--mailman/database/requests.py4
-rw-r--r--mailman/database/roster.py4
-rw-r--r--mailman/database/transaction.py4
-rw-r--r--mailman/database/types.py2
-rw-r--r--mailman/database/user.py4
-rw-r--r--mailman/database/usermanager.py4
-rw-r--r--mailman/database/version.py2
18 files changed, 44 insertions, 38 deletions
diff --git a/mailman/database/__init__.py b/mailman/database/__init__.py
index dfafe4473..4c2a60e5d 100644
--- a/mailman/database/__init__.py
+++ b/mailman/database/__init__.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2006-2008 by the Free Software Foundation, Inc.
+# Copyright (C) 2006-2009 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
@@ -21,8 +21,10 @@ __all__ = [
]
import os
+import logging
from locknix.lockfile import Lock
+from lazr.config import as_boolean
from pkg_resources import resource_string
from storm.locals import create_database, Store
from string import Template
@@ -31,14 +33,16 @@ from zope.interface import implements
import mailman.version
-from mailman.configuration import config
+from mailman.config import config
from mailman.database.listmanager import ListManager
from mailman.database.messagestore import MessageStore
from mailman.database.pending import Pendings
from mailman.database.requests import Requests
from mailman.database.usermanager import UserManager
from mailman.database.version import Version
-from mailman.interfaces import IDatabase, SchemaVersionMismatchError
+from mailman.interfaces.database import IDatabase, SchemaVersionMismatchError
+
+log = logging.getLogger('mailman.config')
@@ -82,8 +86,8 @@ class StockDatabase:
def _create(self, debug):
# Calculate the engine url.
- url = Template(config.DEFAULT_DATABASE_URL).safe_substitute(
- config.paths)
+ url = Template(config.database.url).safe_substitute(config.paths)
+ log.debug('Database url: %s', url)
# XXX By design of SQLite, database file creation does not honor
# umask. See their ticket #1193:
# http://www.sqlite.org/cvstrac/tktview?tn=1193,31
@@ -101,7 +105,7 @@ class StockDatabase:
touch(url)
database = create_database(url)
store = Store(database)
- database.DEBUG = (config.DEFAULT_DATABASE_ECHO
+ database.DEBUG = (as_boolean(config.database.debug)
if debug is None else debug)
# Check the sqlite master database to see if the version file exists.
# If so, then we assume the database schema is correctly initialized.
diff --git a/mailman/database/address.py b/mailman/database/address.py
index 95e3007ef..f5039cf15 100644
--- a/mailman/database/address.py
+++ b/mailman/database/address.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2006-2008 by the Free Software Foundation, Inc.
+# Copyright (C) 2006-2009 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
@@ -25,7 +25,7 @@ from email.utils import formataddr
from storm.locals import *
from zope.interface import implements
-from mailman.configuration import config
+from mailman.config import config
from mailman.database.member import Member
from mailman.database.model import Model
from mailman.database.preferences import Preferences
diff --git a/mailman/database/language.py b/mailman/database/language.py
index 82ad247c8..192c9a142 100644
--- a/mailman/database/language.py
+++ b/mailman/database/language.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2006-2008 by the Free Software Foundation, Inc.
+# Copyright (C) 2006-2009 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
diff --git a/mailman/database/listmanager.py b/mailman/database/listmanager.py
index c4cebce4c..f6a0f5185 100644
--- a/mailman/database/listmanager.py
+++ b/mailman/database/listmanager.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2008 by the Free Software Foundation, Inc.
+# Copyright (C) 2007-2009 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
@@ -22,7 +22,7 @@ import datetime
from zope.interface import implements
from mailman.Utils import split_listname, fqdn_listname
-from mailman.configuration import config
+from mailman.config import config
from mailman.database.mailinglist import MailingList
from mailman.interfaces import IListManager, ListAlreadyExistsError
diff --git a/mailman/database/mailinglist.py b/mailman/database/mailinglist.py
index d5e6fd7b8..641245daf 100644
--- a/mailman/database/mailinglist.py
+++ b/mailman/database/mailinglist.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2006-2008 by the Free Software Foundation, Inc.
+# Copyright (C) 2006-2009 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
@@ -21,8 +21,9 @@ import string
from storm.locals import *
from zope.interface import implements
+from mailman import Defaults
from mailman.Utils import fqdn_listname, makedirs, split_listname
-from mailman.configuration import config
+from mailman.config import config
from mailman.database import roster
from mailman.database.model import Model
from mailman.database.types import Enum
@@ -218,7 +219,7 @@ class MailingList(Model):
@property
def no_reply_address(self):
- return '%s@%s' % (config.NO_REPLY_ADDRESS, self.host_name)
+ return '%s@%s' % (config.mailman.noreply_address, self.host_name)
@property
def owner_address(self):
@@ -249,7 +250,7 @@ class MailingList(Model):
return '%s-unsubscribe@%s' % (self.list_name, self.host_name)
def confirm_address(self, cookie):
- template = string.Template(config.VERP_CONFIRM_FORMAT)
+ template = string.Template(Defaults.VERP_CONFIRM_FORMAT)
local_part = template.safe_substitute(
address = '%s-confirm' % self.list_name,
cookie = cookie)
diff --git a/mailman/database/member.py b/mailman/database/member.py
index a4011840a..244e0853b 100644
--- a/mailman/database/member.py
+++ b/mailman/database/member.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2008 by the Free Software Foundation, Inc.
+# Copyright (C) 2007-2009 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
@@ -19,7 +19,7 @@ from storm.locals import *
from zope.interface import implements
from mailman.Utils import split_listname
-from mailman.configuration import config
+from mailman.config import config
from mailman.constants import SystemDefaultPreferences
from mailman.database.model import Model
from mailman.database.types import Enum
diff --git a/mailman/database/message.py b/mailman/database/message.py
index 578445acf..b62fe580b 100644
--- a/mailman/database/message.py
+++ b/mailman/database/message.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2008 by the Free Software Foundation, Inc.
+# Copyright (C) 2007-2009 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
@@ -18,7 +18,7 @@
from storm.locals import *
from zope.interface import implements
-from mailman.configuration import config
+from mailman.config import config
from mailman.database.model import Model
from mailman.interfaces import IMessage
diff --git a/mailman/database/messagestore.py b/mailman/database/messagestore.py
index a784f89cc..934015b10 100644
--- a/mailman/database/messagestore.py
+++ b/mailman/database/messagestore.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2008 by the Free Software Foundation, Inc.
+# Copyright (C) 2007-2009 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
@@ -29,7 +29,7 @@ import cPickle as pickle
from zope.interface import implements
from mailman import Utils
-from mailman.configuration import config
+from mailman.config import config
from mailman.database.message import Message
from mailman.interfaces import IMessageStore
diff --git a/mailman/database/model.py b/mailman/database/model.py
index fa4de3420..598f537e8 100644
--- a/mailman/database/model.py
+++ b/mailman/database/model.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2006-2008 by the Free Software Foundation, Inc.
+# Copyright (C) 2006-2009 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
diff --git a/mailman/database/pending.py b/mailman/database/pending.py
index 31cc4e285..ff794c83c 100644
--- a/mailman/database/pending.py
+++ b/mailman/database/pending.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2008 by the Free Software Foundation, Inc.
+# Copyright (C) 2007-2009 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
@@ -27,7 +27,8 @@ from storm.locals import *
from zope.interface import implements
from zope.interface.verify import verifyObject
-from mailman.configuration import config
+from mailman import Defaults
+from mailman.config import config
from mailman.database.model import Model
from mailman.interfaces import (
IPendable, IPended, IPendedKeyValue, IPendings)
@@ -79,7 +80,7 @@ class Pendings(object):
verifyObject(IPendable, pendable)
# Calculate the token and the lifetime.
if lifetime is None:
- lifetime = config.PENDING_REQUEST_LIFE
+ lifetime = Defaults.PENDING_REQUEST_LIFE
# Calculate a unique token. Algorithm vetted by the Timbot. time()
# has high resolution on Linux, clock() on Windows. random gives us
# about 45 bits in Python 2.2, 53 bits on Python 2.3. The time and
diff --git a/mailman/database/preferences.py b/mailman/database/preferences.py
index 54d40bb2f..d7d899c44 100644
--- a/mailman/database/preferences.py
+++ b/mailman/database/preferences.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2006-2008 by the Free Software Foundation, Inc.
+# Copyright (C) 2006-2009 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
diff --git a/mailman/database/requests.py b/mailman/database/requests.py
index 963d34cc4..addaf08eb 100644
--- a/mailman/database/requests.py
+++ b/mailman/database/requests.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2008 by the Free Software Foundation, Inc.
+# Copyright (C) 2007-2009 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
@@ -21,7 +21,7 @@ from datetime import timedelta
from storm.locals import *
from zope.interface import implements
-from mailman.configuration import config
+from mailman.config import config
from mailman.database.model import Model
from mailman.database.types import Enum
from mailman.interfaces import IListRequests, IPendable, IRequests, RequestType
diff --git a/mailman/database/roster.py b/mailman/database/roster.py
index 60087c243..d044cc386 100644
--- a/mailman/database/roster.py
+++ b/mailman/database/roster.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2008 by the Free Software Foundation, Inc.
+# Copyright (C) 2007-2009 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
@@ -38,7 +38,7 @@ __all__ = [
from storm.locals import *
from zope.interface import implements
-from mailman.configuration import config
+from mailman.config import config
from mailman.constants import SystemDefaultPreferences
from mailman.database.address import Address
from mailman.database.member import Member
diff --git a/mailman/database/transaction.py b/mailman/database/transaction.py
index 14c494f89..4663f6110 100644
--- a/mailman/database/transaction.py
+++ b/mailman/database/transaction.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2006-2008 by the Free Software Foundation, Inc.
+# Copyright (C) 2006-2009 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
@@ -23,7 +23,7 @@ __all__ = [
]
-from mailman.configuration import config
+from mailman.config import config
diff --git a/mailman/database/types.py b/mailman/database/types.py
index 133fdd3e1..26bdb0aff 100644
--- a/mailman/database/types.py
+++ b/mailman/database/types.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2008 by the Free Software Foundation, Inc.
+# Copyright (C) 2007-2009 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
diff --git a/mailman/database/user.py b/mailman/database/user.py
index 9d8e87a9f..d54bb048f 100644
--- a/mailman/database/user.py
+++ b/mailman/database/user.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2008 by the Free Software Foundation, Inc.
+# Copyright (C) 2007-2009 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
@@ -19,7 +19,7 @@ from email.utils import formataddr
from storm.locals import *
from zope.interface import implements
-from mailman.configuration import config
+from mailman.config import config
from mailman.database.model import Model
from mailman.database.address import Address
from mailman.database.preferences import Preferences
diff --git a/mailman/database/usermanager.py b/mailman/database/usermanager.py
index fb97f0947..87a8cd208 100644
--- a/mailman/database/usermanager.py
+++ b/mailman/database/usermanager.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2008 by the Free Software Foundation, Inc.
+# Copyright (C) 2007-2009 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
@@ -21,7 +21,7 @@ import os
from zope.interface import implements
-from mailman.configuration import config
+from mailman.config import config
from mailman.database.address import Address
from mailman.database.preferences import Preferences
from mailman.database.user import User
diff --git a/mailman/database/version.py b/mailman/database/version.py
index d5281cde0..83e50b821 100644
--- a/mailman/database/version.py
+++ b/mailman/database/version.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2008 by the Free Software Foundation, Inc.
+# Copyright (C) 2007-2009 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#