summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarry Warsaw2009-01-03 05:47:41 -0500
committerBarry Warsaw2009-01-03 05:47:41 -0500
commit1d0761d2c77ef405beb93f47862d41eee3d0a820 (patch)
tree49cfe33afe1c9d3ecd4b36223486b6379e1ea03f
parent01f35df61d8504c4c2f07943dab9ac1a71718893 (diff)
downloadmailman-1d0761d2c77ef405beb93f47862d41eee3d0a820.tar.gz
mailman-1d0761d2c77ef405beb93f47862d41eee3d0a820.tar.zst
mailman-1d0761d2c77ef405beb93f47862d41eee3d0a820.zip
-rw-r--r--mailman/Archiver/HyperArch.py3
-rw-r--r--mailman/Utils.py9
-rw-r--r--mailman/bin/add_members.py7
-rw-r--r--mailman/bin/list_members.py4
-rw-r--r--mailman/pipeline/smtp_direct.py2
-rw-r--r--mailman/testing/mta.py44
6 files changed, 58 insertions, 11 deletions
diff --git a/mailman/Archiver/HyperArch.py b/mailman/Archiver/HyperArch.py
index bb57e398d..7b65d2f82 100644
--- a/mailman/Archiver/HyperArch.py
+++ b/mailman/Archiver/HyperArch.py
@@ -1139,8 +1139,7 @@ class HyperArchive(pipermail.T):
length = len(text)
if Defaults.ARCHIVER_OBSCURES_EMAILADDRS:
text = re.sub('@', atmark, text)
- URL = self.maillist.GetScriptURL(
- 'listinfo', absolute=1)
+ URL = self.maillist.script_url('listinfo')
else:
URL = 'mailto:' + text
pos = j
diff --git a/mailman/Utils.py b/mailman/Utils.py
index b53dccf92..d977ac0ca 100644
--- a/mailman/Utils.py
+++ b/mailman/Utils.py
@@ -40,10 +40,12 @@ from string import ascii_letters, digits, whitespace, Template
import mailman.templates
+from mailman import Defaults
from mailman import passwords
from mailman.config import config
from mailman.core import errors
+
AT = '@'
CR = '\r'
DOT = '.'
@@ -301,7 +303,8 @@ def Secure_MakeRandomPassword(length):
# We have no available source of cryptographically
# secure random characters. Log an error and fallback
# to the user friendly passwords.
- log.error('urandom not available, passwords not secure')
+ log.errorf(
+ 'urandom not available, passwords not secure')
return UserFriendly_MakeRandomPassword(length)
newbytes = os.read(fd, length - bytesread)
bytes.append(newbytes)
@@ -316,8 +319,8 @@ def Secure_MakeRandomPassword(length):
def MakeRandomPassword(length=None):
if length is None:
- length = config.MEMBER_PASSWORD_LENGTH
- if config.USER_FRIENDLY_PASSWORDS:
+ length = Defaults.MEMBER_PASSWORD_LENGTH
+ if Defaults.USER_FRIENDLY_PASSWORDS:
password = UserFriendly_MakeRandomPassword(length)
else:
password = Secure_MakeRandomPassword(length)
diff --git a/mailman/bin/add_members.py b/mailman/bin/add_members.py
index e94484a9b..7d30cd228 100644
--- a/mailman/bin/add_members.py
+++ b/mailman/bin/add_members.py
@@ -22,12 +22,12 @@ import codecs
from cStringIO import StringIO
from email.utils import parseaddr
-from mailman import errors
from mailman import Message
from mailman import Utils
from mailman import i18n
from mailman.app.membership import add_member
-from mailman.configuration import config
+from mailman.config import config
+from mailman.core import errors
from mailman.interfaces import AlreadySubscribedError, DeliveryMode
from mailman.options import SingleMailingListOptions
@@ -117,7 +117,8 @@ def addall(mlist, subscribers, delivery_mode, ack, admin_notify, outfp):
fullname = u''
password = Utils.MakeRandomPassword()
add_member(mlist, address, fullname, password, delivery_mode,
- config.DEFAULT_SERVER_LANGUAGE, ack, admin_notify)
+ unicode(config.mailman.default_language))
+ # XXX Support ack and admin_notify
except AlreadySubscribedError:
print >> tee, _('Already a member: $subscriber')
except errors.InvalidEmailAddress:
diff --git a/mailman/bin/list_members.py b/mailman/bin/list_members.py
index 925105b51..b969eecf7 100644
--- a/mailman/bin/list_members.py
+++ b/mailman/bin/list_members.py
@@ -19,9 +19,9 @@ import sys
from email.Utils import formataddr
-from mailman import errors
from mailman import Utils
-from mailman.configuration import config
+from mailman.config import config
+from mailman.core import errors
from mailman.i18n import _
from mailman.interfaces import DeliveryStatus
from mailman.options import SingleMailingListOptions
diff --git a/mailman/pipeline/smtp_direct.py b/mailman/pipeline/smtp_direct.py
index 051ba0096..b203ebb8e 100644
--- a/mailman/pipeline/smtp_direct.py
+++ b/mailman/pipeline/smtp_direct.py
@@ -185,7 +185,7 @@ def process(mlist, msg, msgdata):
sender = origsender,
recip = len(recips),
size = msg.original_size,
- seconds = t1 - t0,
+ time = t1 - t0,
refused = len(refused),
smtpcode = 'n/a',
smtpmsg = 'n/a',
diff --git a/mailman/testing/mta.py b/mailman/testing/mta.py
new file mode 100644
index 000000000..af1c19223
--- /dev/null
+++ b/mailman/testing/mta.py
@@ -0,0 +1,44 @@
+# Copyright (C) 2009 by the Free Software Foundation, Inc.
+#
+# This file is part of GNU Mailman.
+#
+# GNU Mailman is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# GNU Mailman. If not, see <http://www.gnu.org/licenses/>.
+
+"""Fake MTA for testing purposes."""
+
+__metaclass__ = type
+__all__ = [
+ 'FakeMTA',
+ ]
+
+
+from zope.interface import implements
+
+from mailman.interfaces.mta import IMailTransportAgent
+
+
+
+class FakeMTA:
+ """Fake MTA for testing purposes."""
+
+ implements(IMailTransportAgent)
+
+ def create(self, mlist):
+ pass
+
+ def delete(self, mlist):
+ pass
+
+ def regenerate(self):
+ pass