summaryrefslogtreecommitdiff
path: root/mailman/queue/news.py
diff options
context:
space:
mode:
authorBarry Warsaw2009-01-06 19:55:59 -0500
committerBarry Warsaw2009-01-06 19:55:59 -0500
commit89f5f76ed31d6ca2faf8e2a783a37e9009b03413 (patch)
treef1023f64501a49917674f5bcd78927aa5cee08ef /mailman/queue/news.py
parent37c255b7b0c1b8ea10c8d24a44c8586de86ffcc6 (diff)
downloadmailman-89f5f76ed31d6ca2faf8e2a783a37e9009b03413.tar.gz
mailman-89f5f76ed31d6ca2faf8e2a783a37e9009b03413.tar.zst
mailman-89f5f76ed31d6ca2faf8e2a783a37e9009b03413.zip
Diffstat (limited to 'mailman/queue/news.py')
-rw-r--r--mailman/queue/news.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/mailman/queue/news.py b/mailman/queue/news.py
index ec744208d..ed408c72e 100644
--- a/mailman/queue/news.py
+++ b/mailman/queue/news.py
@@ -25,15 +25,15 @@ import nntplib
from cStringIO import StringIO
-COMMASPACE = ', '
-
-from mailman import Defaults
from mailman import Utils
+from mailman.config import config
from mailman.interfaces import NewsModeration
from mailman.queue import Runner
+COMMASPACE = ', '
log = logging.getLogger('mailman.error')
+
# Matches our Mailman crafted Message-IDs. See Utils.unique_message_id()
# XXX The move to email.utils.make_msgid() breaks this.
mcre = re.compile(r"""
@@ -64,8 +64,8 @@ class NewsRunner(Runner):
nntp_host, nntp_port = Utils.nntpsplit(mlist.nntp_host)
conn = nntplib.NNTP(nntp_host, nntp_port,
readermode=True,
- user=Defaults.NNTP_USERNAME,
- password=Defaults.NNTP_PASSWORD)
+ user=config.nntp.username,
+ password=config.nntp.password)
conn.post(fp)
except nntplib.error_temp, e:
log.error('(NNTPDirect) NNTP error for list "%s": %s',
@@ -147,9 +147,12 @@ def prepare_message(mlist, msg, msgdata):
# woon't completely sanitize the message, but it will eliminate the bulk
# of the rejections based on message headers. The NNTP server may still
# reject the message because of other problems.
- for header in Defaults.NNTP_REMOVE_HEADERS:
+ for header in config.nntp.remove_headers.split():
del msg[header]
- for header, rewrite in Defaults.NNTP_REWRITE_DUPLICATE_HEADERS:
+ for rewrite_pairs in config.nntp.rewrite_duplicate_headers.splitlines():
+ if len(rewrite_pairs.strip()) == 0:
+ continue
+ header, rewrite = rewrite_pairs.split()
values = msg.get_all(header, [])
if len(values) < 2:
# We only care about duplicates