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

« back to all changes in this revision

Viewing changes to flufl/bounce/_detectors/yahoo.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:
25
25
 
26
26
 
27
27
import re
28
 
import email
29
28
 
 
29
from email.iterators import body_line_iterator
30
30
from email.utils import parseaddr
31
31
from flufl.enum import Enum
32
32
from zope.interface import implements
60
60
            return NoFailures
61
61
        addresses = set()
62
62
        state = ParseState.start
63
 
        for line in email.Iterators.body_line_iterator(msg):
 
63
        for line in body_line_iterator(msg):
64
64
            line = line.strip()
65
65
            if state is ParseState.start and tcre.match(line):
66
66
                state = ParseState.tag_seen
67
67
            elif state is ParseState.tag_seen:
68
68
                mo = acre.match(line)
69
69
                if mo:
70
 
                    addresses.add(mo.group('addr'))
 
70
                    addresses.add(mo.group('addr').encode('us-ascii'))
71
71
                    continue
72
72
                mo = ecre.match(line)
73
73
                if mo: