diff options
author | tkikuchi <> | 2006-02-17 02:42:35 +0000 |
---|---|---|
committer | tkikuchi <> | 2006-02-17 02:42:35 +0000 |
commit | 03cb2bdc170d1ced6e69f75e51198871f378f557 (patch) | |
tree | ecd2f32aed87851bc885c58057b39ea28b9895a1 | |
parent | b0165fb2b136affffe199dc64ff054136be2cb62 (diff) | |
download | mailman2-03cb2bdc170d1ced6e69f75e51198871f378f557.tar.gz mailman2-03cb2bdc170d1ced6e69f75e51198871f378f557.tar.xz mailman2-03cb2bdc170d1ced6e69f75e51198871f378f557.zip |
ch_oneline(): Input string variable is overwritten. Also use list
comprehension where appropriate.
-rw-r--r-- | Mailman/Handlers/CookHeaders.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/Mailman/Handlers/CookHeaders.py b/Mailman/Handlers/CookHeaders.py index 309c8451..ea51abf1 100644 --- a/Mailman/Handlers/CookHeaders.py +++ b/Mailman/Handlers/CookHeaders.py @@ -327,20 +327,16 @@ def prefix_subject(mlist, msg, msgdata): -def ch_oneline(s): +def ch_oneline(headerstr): # Decode header string in one line and convert into single charset # copied and modified from ToDigest.py and Utils.py # return (string, cset) tuple as check for failure try: - d = decode_header(s) + d = decode_header(headerstr) # at this point, we should rstrip() every string because some # MUA deliberately add trailing spaces when composing return # message. - i = 0 - for (s,c) in d: - s = s.rstrip() - d[i] = (s,c) - i += 1 + d = [(s.rstrip(), c) for (s,c) in d] cset = 'us-ascii' for x in d: # search for no-None charset @@ -353,4 +349,4 @@ def ch_oneline(s): return oneline.encode(cset, 'replace'), cset except (LookupError, UnicodeError, ValueError, HeaderParseError): # possibly charset problem. return with undecoded string in one line. - return ''.join(s.splitlines()), 'us-ascii' + return ''.join(headerstr.splitlines()), 'us-ascii' |