aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman/Gui
diff options
context:
space:
mode:
authorMark Sapiro <mark@msapiro.net>2016-07-14 19:10:24 -0700
committerMark Sapiro <mark@msapiro.net>2016-07-14 19:10:24 -0700
commitb17234a23a590d9b27f3f609781596eea27b6974 (patch)
tree6d065e88b6a68a6fbc989a4b8e425769da00d293 /Mailman/Gui
parent6efea059931995de8713f35bccc1116905175cf2 (diff)
downloadmailman2-b17234a23a590d9b27f3f609781596eea27b6974.tar.gz
mailman2-b17234a23a590d9b27f3f609781596eea27b6974.tar.xz
mailman2-b17234a23a590d9b27f3f609781596eea27b6974.zip
Match header_filter_rules as normalized unicodes.
Diffstat (limited to 'Mailman/Gui')
-rw-r--r--Mailman/Gui/Privacy.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/Mailman/Gui/Privacy.py b/Mailman/Gui/Privacy.py
index e500908d..2a9cca26 100644
--- a/Mailman/Gui/Privacy.py
+++ b/Mailman/Gui/Privacy.py
@@ -17,6 +17,7 @@
"""MailList mixin class managing the privacy options."""
+import os
import re
from Mailman import mm_cfg
@@ -658,9 +659,20 @@ class Privacy(GUIBase):
doc.addError(_("""Header filter rules require a pattern.
Incomplete filter rules will be ignored."""))
continue
- # Make sure the pattern was a legal regular expression
+ # Make sure the pattern was a legal regular expression.
+ # Convert it to unicode if necessary.
+ mo = re.match('.*charset=([-_a-z0-9]+)',
+ os.environ.get('CONTENT_TYPE', ''),
+ re.IGNORECASE
+ )
+ if mo:
+ cset = mo.group(1)
+ else:
+ cset = Utils.GetCharSet(mlist.preferred_language)
try:
- re.compile(pattern)
+ upattern = Utils.xml_to_unicode(pattern, cset)
+ re.compile(upattern)
+ pattern = upattern
except (re.error, TypeError):
safepattern = Utils.websafe(pattern)
doc.addError(_("""The header filter rule pattern