Skip to content

Instantly share code, notes, and snippets.

@komeda-shinji
Created April 10, 2015 06:35
Show Gist options
  • Save komeda-shinji/1fb445ba746af9711c4c to your computer and use it in GitHub Desktop.
Save komeda-shinji/1fb445ba746af9711c4c to your computer and use it in GitHub Desktop.
Mailman の会員検索で、マルチバイトな会員名での検索ができない ref: http://qiita.com/komeda-shinji/items/0d8f1e3b03018d9c4cca
--- Mailman/Cgi/admin.py 2014-02-04 02:09:14.000000000 +0900
+++ Mailman/Cgi/admin.py 2015-04-10 15:13:58.810916527 +0900
@@ -900,12 +900,16 @@
# The email addresses had /better/ be ASCII, but might be encoded in the
# database as Unicodes.
all = [_m.encode() for _m in mlist.getMembers()]
all.sort(lambda x, y: cmp(x.lower(), y.lower()))
# See if the query has a regular expression
regexp = cgidata.getvalue('findmember', '').strip()
+ try:
+ regexp = regexp.decode(Utils.GetCharSet(mlist.preferred_language))
+ except:
+ pass
if regexp:
try:
cre = re.compile(regexp, re.IGNORECASE)
except re.error:
doc.addError(_('Bad regular expression: ') + regexp)
else:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment