changeset 336:c39981463fb2

fixed MoinMoinBugs/ErraticGetValMacroExpansion. Corrected REs for Dict and Group pages. Use spaces insted of \s because this matches newlines! imported from: moin--main--1.5--patch-340
author Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
date Mon, 19 Dec 2005 12:49:11 +0000
parents e574cc401e89
children db49fa6d12a6
files MoinMoin/wikidicts.py docs/CHANGES
diffstat 2 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/wikidicts.py	Mon Dec 19 08:21:45 2005 +0000
+++ b/MoinMoin/wikidicts.py	Mon Dec 19 12:49:11 2005 +0000
@@ -42,11 +42,7 @@
         """
         self.name = name
 
-        # Lazy compile class regex on first use. All instances share the
-        # same regex, compiled once when the first instance is created.
-        if isinstance(self.__class__.regex, (str, unicode)):
-            self.__class__.regex = re.compile(self.__class__.regex,
-                                              re.MULTILINE | re.UNICODE)
+        self.regex = re.compile(self.regex, re.MULTILINE | re.UNICODE)
 
         # Get text from page named 'name'
         p = Page.Page(request, name)
@@ -86,7 +82,7 @@
        any text ignored      
     '''
     # Key:: Value - ignore all but key:: value pairs, strip whitespace
-    regex = r'^\s(?P<key>.+?)::\s(?P<val>.*?)\s*$'
+    regex = r'^ (?P<key>.+?):: (?P<val>.*?) *$'
 
     def initFromText(self, text):
         """ Create dict from keys and values in text
@@ -97,7 +93,6 @@
         for match in self.regex.finditer(text):
             key, val = match.groups()
             self._dict[key] = val
-    
 
 class Group(DictBase):
     ''' Group of users, of pages, of whatever
@@ -117,7 +112,7 @@
     '''
     # * Member - ignore all but first level list items, strip whitespace
     # Strip free links markup if exists
-    regex = r'^\s\*\s+(?:\[\")?(?P<member>.+?)(?:\"\])?\s*$'
+    regex = r'^ \* +(?:\[\")?(?P<member>.+?)(?:\"\])? *$'
 
     def initFromText(self, text):
         """ Create dict from group members in text
--- a/docs/CHANGES	Mon Dec 19 08:21:45 2005 +0000
+++ b/docs/CHANGES	Mon Dec 19 12:49:11 2005 +0000
@@ -38,6 +38,8 @@
     * fixed invalid HTML in FootNotes
     * fixed HTML source in EditorBackup after canceling GUI editor
     * Footnotes of included pages are not shown at the bottom of the including page.
+    * Bug in Dict handling that often breaks first entry
+
 Version 1.5.0beta6:
   Authentication:
     * Added SSO module for PHP based apps. Currently supported: eGroupware 1.2.