Improved wikipage_from_str: Now it does not accept '[' or ']' in article titles.
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Fri, 27 Jan 2017 22:03:55 +0000 (22:03 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Fri, 27 Jan 2017 22:03:55 +0000 (22:03 +0000)
git-svn-id: http://www.winterrodeln.org/svn/wrpylib/trunk@2604 7aebc617-e5e2-0310-91dc-80fb5f6d2477

wrpylib/wrvalidators.py

index 2bab58864c68e406d8ac85cf9cd3406b5466fc1c..f10348d2957a49387879ead5622f1ca2e62539ab 100644 (file)
@@ -354,7 +354,7 @@ def wikipage_from_str(value):
     An empty string is an error.
     '[[Birgitzer Alm]]' => '[[Birgitzer Alm]]'
     """
-    if not value.startswith('[[') or not value.endswith(']]'):
+    if re.match(r'\[\[[^\[\]]+\]\]$', value) is None:
         raise ValueError('No valid wiki page name "{}"'.format(value))
     return value