changeset 1044:0f7f98a19685

Fixed sre unpickle issues seen on some machines by avoiding to pickle the regex.
author Alexander Schremmer <alex AT alexanderweb DOT de>
date Sat, 22 Jul 2006 13:24:39 +0200
parents 719c89b31850
children 4725c8ac809a
files MoinMoin/wikidicts.py
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/wikidicts.py	Sat Jul 22 13:24:05 2006 +0200
+++ b/MoinMoin/wikidicts.py	Sat Jul 22 13:24:39 2006 +0200
@@ -26,7 +26,7 @@
 
 # Version of the internal data structure which is pickled
 # Please increment if you have changed the structure
-DICTS_PICKLE_VERSION = 4
+DICTS_PICKLE_VERSION = 5
 
 
 class DictBase:
@@ -44,13 +44,18 @@
         """
         self.name = name
 
-        self.regex = re.compile(self.regex, re.MULTILINE | re.UNICODE)
+        self.initRegex()
 
         # Get text from page named 'name'
         p = Page.Page(request, name)
         text = p.get_raw_body()
         self.initFromText(text)
 
+    def initRegex(cls):
+        """ Make it a class attribute to avoid it being pickled. """
+        cls.regex = re.compile(cls.regex, re.MULTILINE | re.UNICODE)
+    initRegex = classmethod(initRegex)
+
     def initFromText(self, text):
         raise NotImplementedError('sub classes should override this')