diff MoinMoin/wikiutil.py @ 2455:fe71235f1f7c

ParameterParser: changed to return fixed_count, arg_dict, putting positional args into arg_dict[pos], more tests
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 21 Jul 2007 23:00:25 +0200
parents adf5ec4874ed
children 15502589ece6
line wrap: on
line diff
--- a/MoinMoin/wikiutil.py	Sat Jul 21 21:40:39 2007 +0200
+++ b/MoinMoin/wikiutil.py	Sat Jul 21 23:00:25 2007 +0200
@@ -1359,6 +1359,7 @@
 
         i = 0
         start = 0
+        fixed_count = 0
         named = False
 
         while start < len(params):
@@ -1384,7 +1385,7 @@
             else:
                 raise ValueError("Parameter parser code does not fit param_re regex")
 
-            parameter_list.append(value)
+            #parameter_list.append(value)
             name = match.group("name")
             if name:
                 if name not in self.param_dict:
@@ -1402,6 +1403,8 @@
                 raise ValueError("only named parameters allowed after first named parameter")
             else:
                 nr = i
+                if nr not in self.param_dict.values():
+                    fixed_count = nr + 1
                 parameter_list[nr] = value
 
             # Let's populate and map our dictionary to what's been found
@@ -1411,7 +1414,10 @@
 
             i += 1
 
-        return parameter_list, parameter_dict
+        for i in range(fixed_count):
+            parameter_dict[i] = parameter_list[i]
+
+        return fixed_count, parameter_dict
 
 """ never used:
     def _check_type(value, type, format):