aboutsummaryrefslogtreecommitdiffstats
path: root/mail2news.py
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2014-12-21 22:18:48 +0100
committerMatěj Cepl <mcepl@cepl.eu>2014-12-21 22:43:08 +0100
commit52b3df8247561fa138b273efd18e7f03a54880ef (patch)
treedb629d4d90eded920160dbf2c63b80e483fa8a4b /mail2news.py
parentaaba562ae6e30c3b8e18938eea58f0a8df73bd57 (diff)
downloadpyg-52b3df8247561fa138b273efd18e7f03a54880ef.tar.gz
switch to argparse in pygn2m
and cleanup in pygn2m, news2mail.py (and some leftovers in pygm2n)
Diffstat (limited to 'mail2news.py')
-rw-r--r--mail2news.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/mail2news.py b/mail2news.py
index 3011a4e..e7cbcf9 100644
--- a/mail2news.py
+++ b/mail2news.py
@@ -14,11 +14,9 @@ Gets news email and sends it via SMTP.
class mail2news is hopefully conform to rfc850.
"""
-
import sys
from os import getpid
from socket import gethostbyaddr, gethostname
-import string
from re import findall
import nntplib
import pyginfo
@@ -79,14 +77,14 @@ class mail2news:
# if it is a multi-line header like Received:
if line[0] not in [' ', '\t']:
try:
- head, value = string.split(line, ' ', 1)
- except string.index_error:
+ head, value = line.split(' ', 1)
+ except ValueError:
value = ''
self.smtpheads[head] = value
else:
self.smtpheads[head] = '%s%s' % \
(self.smtpheads[head], line)
- except (string.index_error), message:
+ except (ValueError), message:
print('line: %s' % line)
print('(probably missing couple "Header: value" in %s)'
% line)
@@ -95,7 +93,7 @@ class mail2news:
elif len(line) > 0 and body:
self.body.append(line)
- except (string.index_error), message:
+ except (ValueError), message:
print message
sys.exit(1)