~barry/mailman/lp1423756

« back to all changes in this revision

Viewing changes to src/mailman/runners/nntp.py

  • Committer: Barry Warsaw
  • Date: 2015-01-05 01:20:33 UTC
  • mfrom: (7264.4.66 py3)
  • Revision ID: barry@list.org-20150105012033-zdrw9c2odhpf22fz
Merge the Python 3 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""NNTP runner."""
19
19
 
20
 
from __future__ import absolute_import, print_function, unicode_literals
21
 
 
22
 
__metaclass__ = type
23
20
__all__ = [
24
21
    'NNTPRunner',
25
22
    ]
31
28
import logging
32
29
import nntplib
33
30
 
34
 
from cStringIO import StringIO
35
 
 
36
31
from mailman.config import config
37
32
from mailman.core.runner import Runner
38
33
from mailman.interfaces.nntp import NewsgroupModeration
 
34
from six.moves import cStringIO as StringIO
 
35
 
39
36
 
40
37
COMMA = ','
41
38
COMMASPACE = ', '
82
79
                                user=config.nntp.user,
83
80
                                password=config.nntp.password)
84
81
            conn.post(fp)
85
 
        except nntplib.error_temp:
 
82
        except nntplib.NNTPTemporaryError:
86
83
            log.exception('{0} NNTP error for {1}'.format(
87
84
                msg.get('message-id', 'n/a'), mlist.fqdn_listname))
88
85
        except socket.error:
111
108
        del msg['approved']
112
109
        msg['Approved'] = mlist.posting_address
113
110
    # Should we restore the original, non-prefixed subject for gatewayed
114
 
    # messages? TK: We use stripped_subject (prefix stripped) which was
115
 
    # crafted in CookHeaders.py to ensure prefix was stripped from the subject
116
 
    # came from mailing list user.
 
111
    # messages? TK: We use stripped_subject (prefix stripped) which was crafted
 
112
    # in the subject-prefix handler to ensure prefix was stripped from the
 
113
    # subject came from mailing list user.
117
114
    stripped_subject = msgdata.get('stripped_subject',
118
115
                                   msgdata.get('original_subject'))
119
116
    if not mlist.nntp_prefix_subject_too and stripped_subject is not None: