~paulegan/flufl.bounce/caiwireless-bug-917720

« back to all changes in this revision

Viewing changes to flufl/bounce/_detectors/exim.py

  • Committer: Barry Warsaw
  • Date: 2012-01-04 16:39:36 UTC
  • Revision ID: barry@python.org-20120104163936-qrrd7ipqrprpxwvp
 * Port to Python 3 is mostly complete, however the test suite current fails
   because of <https://bugs.launchpad.net/zope.interface/+bug/911851>.  Once
   that bug is fixed in `zope.interface`, `flufl.bounce` should be Python 3.2
   compatible without the need for `2to3`.
 * All returned addresses are bytes objects in Python 3 and 8-bit strings in
   Python 2 (no change there).

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
 
44
44
    def process(self, msg):
45
45
        """See `IBounceDetector`."""
46
 
        all = msg.get_all('x-failed-recipients', [])
 
46
        all_failed = msg.get_all('x-failed-recipients', [])
 
47
        # all_failed will contain string/unicode values, but the flufl.bounce
 
48
        # API requires these to be bytes.  We don't know the encoding, but
 
49
        # assume it must be ascii, per the relevant RFCs.
47
50
        return (NoTemporaryFailures,
48
 
                set(address for name, address in getaddresses(all)))
 
51
                set(address.encode('us-ascii')
 
52
                    for name, address in getaddresses(all_failed)))