diff MoinMoin/config/multiconfig.py @ 1549:e36313297589

introduce request.cfg.cache object, start using it for some precompiled regexes
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 14 Sep 2006 22:08:45 +0200
parents 2eb5117aa7de
children f9639ed07af2
line wrap: on
line diff
--- a/MoinMoin/config/multiconfig.py	Thu Sep 14 18:37:05 2006 +0200
+++ b/MoinMoin/config/multiconfig.py	Thu Sep 14 22:08:45 2006 +0200
@@ -184,6 +184,11 @@
 def _(text): return text
 
 
+class CacheClass:
+    """ just a container for stuff we cache """
+    pass
+
+
 class DefaultConfig:
     """ default config values """
 
@@ -523,6 +528,8 @@
     def __init__(self, siteid):
         """ Init Config instance """
         self.siteid = siteid
+        self.cache = CacheClass()
+
         if self.config_check_enabled:
             self._config_check()
 
@@ -538,6 +545,13 @@
         # Try to decode certain names which allow unicode
         self._decode()
 
+        # After that, pre-compile some regexes
+        self.cache.page_category_regex = re.compile(self.page_category_regex, re.UNICODE)
+        self.cache.page_dict_regex = re.compile(self.page_dict_regex, re.UNICODE)
+        self.cache.page_group_regex = re.compile(self.page_group_regex, re.UNICODE)
+        self.cache.page_template_regex = re.compile(self.page_template_regex, re.UNICODE)
+        self.cache.ua_spiders = re.compile(self.ua_spiders, re.I)
+
         self._check_directories()
 
         if not isinstance(self.superuser, list):