Source

trac-ticketlinks / trac / wiki / api.py

Diff from to

trac/wiki/api.py

 from trac.config import BoolOption, ListOption
 from trac.core import *
 from trac.resource import IResourceManager
+from trac.util.compat import all
 from trac.util.translation import _
 from trac.wiki.parser import WikiParser
 
     return largs, kwargs
 
 
+def validate_page_name(pagename):
+    """Utility for validating wiki page name.
+
+    :param pagename: wiki page name to validate
+    """
+    return pagename and \
+           all(part not in ('', '.', '..') for part in pagename.split('/'))
+
+
 class WikiSystem(Component):
     """Wiki system manager."""