diff options
| author | bwarsaw | 2002-10-02 13:55:22 +0000 |
|---|---|---|
| committer | bwarsaw | 2002-10-02 13:55:22 +0000 |
| commit | 27d6e3959e6c4563dbbd4812230d251237ba9fd9 (patch) | |
| tree | e1fcebf415d56578276d4d8c44820052a5df32a4 | |
| parent | b2189e6264152b5685a2cc7c3faddf544c6f5c8e (diff) | |
| download | mailman-27d6e3959e6c4563dbbd4812230d251237ba9fd9.tar.gz mailman-27d6e3959e6c4563dbbd4812230d251237ba9fd9.tar.zst mailman-27d6e3959e6c4563dbbd4812230d251237ba9fd9.zip | |
| -rw-r--r-- | Mailman/Utils.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Mailman/Utils.py b/Mailman/Utils.py index 3443393fa..e5be24c0c 100644 --- a/Mailman/Utils.py +++ b/Mailman/Utils.py @@ -507,8 +507,12 @@ def is_administrivia(msg): if ADMINDATA.has_key(bodytext.strip().lower()): return 1 # Look at the first N lines and see if there is any administrivia on the - # line. BAW: N is currently hardcoded to 5. - for line in lines[:5] + [msg.get('subject', '')]: + # line. BAW: N is currently hardcoded to 5. str-ify the Subject: header + # because it may be an email.Header.Header instance rather than a string. + bodylines = lines[:5] + subject = str(msg.get('subject', '')) + bodylines.append(subject) + for line in bodylines: if not line.strip(): continue words = [word.lower() for word in line.split()] @@ -751,6 +755,7 @@ def uncanonstr(s, lang=None): charset = 'us-ascii' else: charset = GetCharSet(lang) + # BAW should change this to a type types of s try: return s.encode(charset, 'strict') except UnicodeError: @@ -761,4 +766,5 @@ def uncanonstr(s, lang=None): a.append('&#%3d;' % o) else: a.append(c) - return EMPTYSTRING.join(a) + # Join characters together and coerce to byte string + return str(EMPTYSTRING.join(a)) |
