aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman/Gui/Privacy.py
diff options
context:
space:
mode:
authorYasuhito FUTATSUKI at POEM <futatuki@poem.co.jp>2016-07-17 06:39:50 +0900
committerYasuhito FUTATSUKI at POEM <futatuki@poem.co.jp>2016-07-17 06:39:50 +0900
commit8a31986e68316d0a06919990abad096ee6c0e041 (patch)
tree3d198ba9f0e4e17eaa242c3a4587ee6ec1ae852f /Mailman/Gui/Privacy.py
parent8cac32e5bac4495139573b07da94c255522e8498 (diff)
parentb17234a23a590d9b27f3f609781596eea27b6974 (diff)
downloadmailman2-8a31986e68316d0a06919990abad096ee6c0e041.tar.gz
mailman2-8a31986e68316d0a06919990abad096ee6c0e041.tar.xz
mailman2-8a31986e68316d0a06919990abad096ee6c0e041.zip
Merge lp:mailman/2.1 up to rev 1664
Diffstat (limited to 'Mailman/Gui/Privacy.py')
-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