changeset 2250:07fdbda38be2

move split_regex to config (so it is compiled only once)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 24 Jun 2007 23:24:15 +0200
parents d48a4d0a0c70
children 4197965b0820
files MoinMoin/Page.py MoinMoin/config/__init__.py
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/Page.py	Sun Jun 24 22:36:14 2007 +0200
+++ b/MoinMoin/Page.py	Sun Jun 24 23:24:15 2007 +0200
@@ -734,8 +734,7 @@
 
         # look for the end of words and the start of a new word,
         # and insert a space there
-        split_re = re.compile('([%s])([%s])' % (config.chars_lower, config.chars_upper))
-        splitted = split_re.sub(r'\1 \2', self.page_name)
+        splitted = config.split_regex.sub(r'\1 \2', self.page_name)
         return splitted
 
     def url(self, request, querystr=None, anchor=None, relative=True, **kw):
--- a/MoinMoin/config/__init__.py	Sun Jun 24 22:36:14 2007 +0200
+++ b/MoinMoin/config/__init__.py	Sun Jun 24 23:24:15 2007 +0200
@@ -34,6 +34,9 @@
 # benefit for the user. IMPORTANT: use only lowercase 'utf-8'!
 charset = 'utf-8'
 
+# Regex to find lower->upper transitions (word boundaries in WikiNames), used by split_title
+split_regex = re.compile('([%s])([%s])' % (chars_lower, chars_upper))
+
 # Invalid characters - invisible characters that should not be in page
 # names. Prevent user confusion and wiki abuse, e.g u'\u202aFrontPage'.
 page_invalid_chars_regex = re.compile(