changeset 3404:e979e3cad972

parse_quoted_separated_ext: fix unclosed quotes
author Johannes Berg <johannes AT sipsolutions DOT net>
date Sat, 22 Mar 2008 03:47:47 +0100
parents d479e393e318
children 6f5e09f14525
files MoinMoin/_tests/test_wikiutil.py MoinMoin/wikiutil.py
diffstat 2 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/test_wikiutil.py	Sat Mar 22 03:00:25 2008 +0100
+++ b/MoinMoin/_tests/test_wikiutil.py	Sat Mar 22 03:47:47 2008 +0100
@@ -310,6 +310,8 @@
                   (u'a,b,c,d, "a,b,c,d"',     abcd + [u'a,b,c,d']),
                   (u'quote " :), b',          [u'quote " :)', u'b']),
                   (u'"quote "" :)", b',       [u'quote " :)', u'b']),
+                  (u'"unended quote',         [u'"unended quote']),
+                  (u'"',                      [u'"']),
                   (u'd=d,e="a,b,c,d"',        [u'd=d', u'e="a', u'b',
                                                u'c', u'd"']),
                 ]
--- a/MoinMoin/wikiutil.py	Sat Mar 22 03:00:25 2008 +0100
+++ b/MoinMoin/wikiutil.py	Sat Mar 22 03:47:47 2008 +0100
@@ -1478,6 +1478,15 @@
     if bracketstack:
         raise BracketMissingCloseError(bracketstack[-1][0])
 
+    if quoted:
+        if len(cur):
+            if cur[-1] is None:
+                cur[-1] = '"'
+            else:
+                cur[-1] = '"' + cur[-1]
+        else:
+            cur.append('"')
+
     additem(result, cur, separator_count, nextitemsep)
 
     return result