summaryrefslogtreecommitdiff
path: root/Mailman/Queue
diff options
context:
space:
mode:
authorbwarsaw2007-03-21 21:16:56 +0000
committerbwarsaw2007-03-21 21:16:56 +0000
commitcdefb7ba2792083a520f8dc40993a0f946ad3434 (patch)
tree9db25722807381a8bae8cf28e4354c4aa68ffb5d /Mailman/Queue
parentfc51f4c9de9751c03fb21394b393253e8c225453 (diff)
downloadmailman-cdefb7ba2792083a520f8dc40993a0f946ad3434.tar.gz
mailman-cdefb7ba2792083a520f8dc40993a0f946ad3434.tar.zst
mailman-cdefb7ba2792083a520f8dc40993a0f946ad3434.zip
A few style fixes based on commit reviews.
Switchboard.py - Use listname.encode('utf-8') to produce the necessary 8-bit string, instead of str(listname). Also update the preceding comment. senddigests.py - Remove an unnecessary import. Decorate.py - Remove a commented out section of code. - Remove some redundant local variables - Reorganize the section that's trying to find a usable encoding for the payload of the modified message. I don't think it really hurts much to try duplicate charsets when lcset == mcset, or when either == utf-8. Just go ahead and try them and let them fail. This simplifies the code. Also, try to get just the minimum necessary code under the UnicodeError. I think it's enough to catch the payload.encode() call.
Diffstat (limited to 'Mailman/Queue')
-rw-r--r--Mailman/Queue/Switchboard.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Mailman/Queue/Switchboard.py b/Mailman/Queue/Switchboard.py
index 43d121f6f..fabb1d099 100644
--- a/Mailman/Queue/Switchboard.py
+++ b/Mailman/Queue/Switchboard.py
@@ -94,7 +94,9 @@ class Switchboard:
else:
protocol = 0
msgsave = cPickle.dumps(str(_msg), protocol)
- hashfood = msgsave + str(listname) + `now`
+ # listname is unicode but the input to the hash function must be an
+ # 8-bit string (eventually, a bytes object).
+ hashfood = msgsave + listname.encode('utf-8') + `now`
# Encode the current time into the file name for FIFO sorting in
# files(). The file name consists of two parts separated by a `+':
# the received time for this message (i.e. when it first showed up on