summaryrefslogtreecommitdiff
path: root/django/utils/text.py
diff options
context:
space:
mode:
authorJoseph Kocherhans <joseph@jkocherhans.com>2010-02-24 20:52:14 +0000
committerJoseph Kocherhans <joseph@jkocherhans.com>2010-02-24 20:52:14 +0000
commitc8cd8b80aa90f463814e1957d26e4a11f2f94414 (patch)
treef4b29b7d2d73b287c579216b30be9586ceb22b61 /django/utils/text.py
parent3304afa67a39df10dca432aa5297d15a1795aae6 (diff)
Fixed #12119. Changed smart_split to stop splitting on whitespace in quotes. Thanks, emulbreh.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12581 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils/text.py')
-rw-r--r--django/utils/text.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/django/utils/text.py b/django/utils/text.py
index 624f5b6a55..5d633b7afe 100644
--- a/django/utils/text.py
+++ b/django/utils/text.py
@@ -202,9 +202,14 @@ javascript_quote = allow_lazy(javascript_quote, unicode)
# Expression to match some_token and some_token="with spaces" (and similarly
# for single-quoted strings).
smart_split_re = re.compile(r"""
- ([^\s"]*"(?:[^"\\]*(?:\\.[^"\\]*)*)"\S*|
- [^\s']*'(?:[^'\\]*(?:\\.[^'\\]*)*)'\S*|
- \S+)""", re.VERBOSE)
+ ((?:
+ [^\s'"]*
+ (?:
+ (?:"(?:[^"\\]|\\.)*" | '(?:[^'\\]|\\.)*')
+ [^\s'"]*
+ )+
+ ) | \S+)
+""", re.VERBOSE)
def smart_split(text):
r"""