summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Mailman/Gui/Topics.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Mailman/Gui/Topics.py b/Mailman/Gui/Topics.py
index 93de25701..b60e38548 100644
--- a/Mailman/Gui/Topics.py
+++ b/Mailman/Gui/Topics.py
@@ -14,6 +14,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+import re
+
from Mailman import mm_cfg
from Mailman.i18n import _
from Mailman.Logging.Syslog import syslog
@@ -115,6 +117,15 @@ class Topics(GUIBase):
a pattern. Incomplete topics will be ignored."""))
continue
+ # Make sure the pattern was a legal regular expression
+ try:
+ syslog('error', 'pattern: %s', pattern)
+ re.compile(pattern)
+ except (re.error, TypeError):
+ doc.addError(_("""The topic pattern `%(pattern)s' is not a
+ legal regular expression. It will be discarded."""))
+ continue
+
# Was this an add item?
if cgidata.has_key(addtag):
# Where should the new one be added?