diff options
| author | bwarsaw | 1999-11-12 04:01:02 +0000 |
|---|---|---|
| committer | bwarsaw | 1999-11-12 04:01:02 +0000 |
| commit | 00eddadf1acd1b47f422e09e98c4973ef5033442 (patch) | |
| tree | 32636ee1e1881c2f69a4f72a858a9ba34882a5ac /Mailman/Handlers/ToUsenet.py | |
| parent | 59fe261ea8176df5fb11e6dc711622e856bae3cd (diff) | |
| download | mailman-00eddadf1acd1b47f422e09e98c4973ef5033442.tar.gz mailman-00eddadf1acd1b47f422e09e98c4973ef5033442.tar.zst mailman-00eddadf1acd1b47f422e09e98c4973ef5033442.zip | |
Fix typos after testing, specifically:
use getattr() not hasattr()
For the outgoing message, take the object passed in as arg, flatten it
via the str() method, and post the StringIO'd wrapper to the nntp
process.
Diffstat (limited to 'Mailman/Handlers/ToUsenet.py')
| -rw-r--r-- | Mailman/Handlers/ToUsenet.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/Mailman/Handlers/ToUsenet.py b/Mailman/Handlers/ToUsenet.py index e151e455b..3cebda464 100644 --- a/Mailman/Handlers/ToUsenet.py +++ b/Mailman/Handlers/ToUsenet.py @@ -16,16 +16,19 @@ """Inject the message to Usenet.""" +import os import string import re +from Mailman.pythonlib.StringIO import StringIO + def process(mlist, msg): # short circuits if not mlist.gateway_to_news or \ - hasattr(msg, 'isdigest', 0) or \ - hasattr(msg, 'fromusenet', 0): + getattr(msg, 'isdigest', 0) or \ + getattr(msg, 'fromusenet', 0): # then return # sanity checks @@ -43,9 +46,6 @@ def process(mlist, msg): if not os.fork(): # child import nntplib - from Mailman import Message - # Now make the news message... - msg = Message.NewsMessage(msg) # Ok, munge headers, etc. subj = msg.getheader('subject') if subj: @@ -110,7 +110,10 @@ def process(mlist, msg): i = string.find(line,":") if i <> -1 and line[i+1] <> ' ': msg.headers[n] = line[:i+1] + ' ' + line[i+1:] + # flatten the message object, stick it in a StringIO object and post + # that resulting thing to the newsgroup + fp = StringIO(str(msg)) conn = nntplib.NNTP(mlist.nntp_host) - conn.post(msg) + conn.post(fp) conn.quit() os._exit(0) |
