diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2022-11-04 13:31:36 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2022-11-04 13:31:36 +0100 |
commit | f5cffc79ecc0cff53f3da596c4e3e0625472296a (patch) | |
tree | a48f0b4492d5a93b88370982bebdb35a374bbd10 /mail2news.py | |
parent | 32e93e67e9e8df254de064e8d7800239ca031400 (diff) | |
download | pyg-f5cffc79ecc0cff53f3da596c4e3e0625472296a.tar.gz |
Run 2to3
Diffstat (limited to 'mail2news.py')
-rw-r--r-- | mail2news.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/mail2news.py b/mail2news.py index 704912a..f9e71c2 100644 --- a/mail2news.py +++ b/mail2news.py @@ -14,7 +14,7 @@ Gets news email and sends it via SMTP. class mail2news is hopefully conform to rfc850. """ -from StringIO import StringIO +from io import StringIO from collections import OrderedDict import email import logging @@ -87,7 +87,7 @@ class mail2news(object): """ try: - for key in self.message.keys(): + for key in list(self.message.keys()): if key.startswith('Resent-'): if ('X-' + key) in self.message: self.message['X-Original-' + key] = \ @@ -98,7 +98,7 @@ class mail2news(object): # In rfc822 References: is considered, but many MUA doen't put it. if ('References' not in self.message) and \ ('In-Reply-To' in self.message): - print self.message['In-Reply-To'] + print(self.message['In-Reply-To']) # some MUA uses msgid without '<' '>' # ref = findall('([^\s<>\']+@[^\s<>;:\']+)', \ @@ -110,8 +110,8 @@ class mail2news(object): if (ref and len(ref)): self.message['References'] = '%s\n' % ref[0] - except KeyError, message: - print message + except KeyError as message: + print(message) def removeheads(self, heads=None): """remove headers like Xref: Path: Lines: @@ -137,15 +137,15 @@ class mail2news(object): msgid = '<pyg.%d@tuchailepuppapera.org>\n' % (os.getpid()) self.message['Message-Id'] = msgid - except KeyError, message: - print message + except KeyError as message: + print(message) def sortheads(self): """make list sorted by heads: From: To: Subject: first, others, X-*, X-Resent-* last""" heads_dict = OrderedDict(self.message) - for hdr in self.message.keys(): + for hdr in list(self.message.keys()): del self.message[hdr] # put at top |