[Mailman-Developers] SimpleMatch.py problem

Bob Puff@NLE bob@nleaudio.com
Thu, 08 Nov 2001 00:42:05 -0500


Hi Barry & gang,

I finally figured out why my few additions to SimpleMatch.py bounce messages weren't working.  It turns out that if one of the lines in one of the previous cases matches, but the other ones don't, the search is aborted immediately, instead of testing the other patterns.  I'm sure this is a simple fix, but I'm not fluent enough in Python (yet) to take a stab at this.  The offending code is:

  state = 0
    while 1:
        line = msg.fp.readline()
        if not line:
            break
        if state == 0:
            for scre, ecre, acre in patterns:
                if scre.search(line):
                    state = 1
                    break
        elif state == 1:
            mo = acre.search(line)
            if mo:
                addrs[mo.group('addr')] = 1
            elif ecre.search(line):
                break
    return addrs.keys() or None
  
Bob