diff MoinMoin/wikiutil.py @ 2528:1ae621d83c5b

fix arg parser bug, test for this bug
author Johannes Berg <johannes AT sipsolutions DOT net>
date Mon, 23 Jul 2007 11:37:05 +0200
parents 4f6f7e56eb40
children 070294763d3e
line wrap: on
line diff
--- a/MoinMoin/wikiutil.py	Mon Jul 23 11:36:37 2007 +0200
+++ b/MoinMoin/wikiutil.py	Mon Jul 23 11:37:05 2007 +0200
@@ -1223,12 +1223,14 @@
               a list of trailing arguments
     """
     idx = 0
+    if not isinstance(args, unicode):
+        raise TypeError('args must be unicode')
     max = len(args)
     ret_positional = [] # positional argument return value
     ret_trailing = []   # trailing arguments return value
     positional = ret_positional
     keyword = {}        # keyword arguments
-    curname = ''        # current name, initially value as well (name=value)
+    curname = u''       # current name, initially value as well (name=value)
     cur = None          # current value
     cur_quoted = False  # indicates whether value was quoted,
                         # needed None vs. u'' handling
@@ -1267,7 +1269,7 @@
                 curname = curname + spaces
         elif not quoted and name_value and char == '=':
             if cur is None:
-                cur = ''
+                cur = u''
                 cur_quoted = False
             else:
                 cur += '='
@@ -1283,7 +1285,7 @@
                 positional = ret_trailing
             else:
                 positional.append(cur)
-            curname = ''
+            curname = u''
             cur = None
             noquote = False
             cur_quoted = False