mirror of
https://github.com/django/django.git
synced 2025-09-21 18:00:45 +00:00
Fixed #9315 -- Handle spaces in URL tag arguments.
Thanks Natalia Bidart and Matías Bordese for most of this patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10462 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
f6309cbf80
commit
be4a83c448
6 changed files with 24 additions and 4 deletions
|
@ -197,7 +197,13 @@ def javascript_quote(s, quote_double_quotes=False):
|
|||
return str(ustring_re.sub(fix, s))
|
||||
javascript_quote = allow_lazy(javascript_quote, unicode)
|
||||
|
||||
smart_split_re = re.compile('("(?:[^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'(?:[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'|[^\\s]+)')
|
||||
# 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)
|
||||
|
||||
def smart_split(text):
|
||||
r"""
|
||||
Generator that splits a string by spaces, leaving quoted phrases together.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue