From 17f5fb0f42407c82ed5bce6cb431c7fe456cc798 Mon Sep 17 00:00:00 2001 From: "Bruno P. Kinoshita" Date: Tue, 19 Mar 2019 00:49:29 +1300 Subject: [PATCH] Consider space a wordchar, not s whitespace in the lexer --- lib/parsec/validate.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/parsec/validate.py b/lib/parsec/validate.py index 2843affd2b9..ad60f8a7c4d 100644 --- a/lib/parsec/validate.py +++ b/lib/parsec/validate.py @@ -381,8 +381,12 @@ def strip_and_unquote_list(cls, keys, value): Processed value as a list. """ if value.startswith('"') or value.startswith("'"): - lexer = shlex.shlex(value, posix=True) - values = [t for t in lexer if t != ","] + lexer = shlex.shlex(value, posix=True, punctuation_chars=",") + lexer.commenters = '#' + lexer.whitespace_split = False + lexer.whitespace = "\t\n\r" + lexer.wordchars += " " + values = [t.strip() for t in lexer if t != ","] else: # unquoted values (may contain internal quoted strings with list # delimiters inside 'em!)