summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mailman/Utils.py11
-rw-r--r--src/mailman/bin/gate_news.py6
-rw-r--r--src/mailman/queue/news.py5
3 files changed, 6 insertions, 16 deletions
diff --git a/src/mailman/Utils.py b/src/mailman/Utils.py
index d952a113a..66e6b41b7 100644
--- a/src/mailman/Utils.py
+++ b/src/mailman/Utils.py
@@ -147,17 +147,6 @@ def websafe(s):
return cgi.escape(s, quote=True)
-def nntpsplit(s):
- parts = s.split(':', 1)
- if len(parts) == 2:
- try:
- return parts[0], int(parts[1])
- except ValueError:
- pass
- # Use the defaults
- return s, 119
-
-
class OuterExit(Exception):
pass
diff --git a/src/mailman/bin/gate_news.py b/src/mailman/bin/gate_news.py
index 1873def37..4ad29affc 100644
--- a/src/mailman/bin/gate_news.py
+++ b/src/mailman/bin/gate_news.py
@@ -26,10 +26,10 @@ import email.Errors
from email.Parser import Parser
from flufl.lock import Lock, TimeOutError
+from lazr.config import as_host_port
from mailman import MailList
from mailman import Message
-from mailman import Utils
from mailman import loginit
from mailman.configuration import config
from mailman.core.i18n import _
@@ -69,8 +69,8 @@ Poll the NNTP servers for messages to be gatewayed to mailing lists."""))
_hostcache = {}
def open_newsgroup(mlist):
- # Split host:port if given
- nntp_host, nntp_port = Utils.nntpsplit(mlist.nntp_host)
+ # Split host:port if given.
+ nntp_host, nntp_port = as_host_port(mlist.nntp_host, default_port=119)
# Open up a "mode reader" connection to nntp server. This will be shared
# for all the gated lists having the same nntp_host.
conn = _hostcache.get(mlist.nntp_host)
diff --git a/src/mailman/queue/news.py b/src/mailman/queue/news.py
index dcb0deba6..a3d915244 100644
--- a/src/mailman/queue/news.py
+++ b/src/mailman/queue/news.py
@@ -24,8 +24,8 @@ import logging
import nntplib
from cStringIO import StringIO
+from lazr.config import as_host_port
-from mailman import Utils
from mailman.config import config
from mailman.interfaces.nntp import NewsModeration
from mailman.queue import Runner
@@ -61,7 +61,8 @@ class NewsRunner(Runner):
conn = None
try:
try:
- nntp_host, nntp_port = Utils.nntpsplit(mlist.nntp_host)
+ nntp_host, nntp_port = as_host_port(
+ mlist.nntp_host, default_port=119)
conn = nntplib.NNTP(nntp_host, nntp_port,
readermode=True,
user=config.nntp.username,