While I was trying to implement allowing filter expressions as
arguments to some built-in template tags (see #5756), I found
inconsistencies in the handling of literal strings in the template
system.
Collin Grady's patch [1] for {% ifequal %} looks good, but using the
same logic for other tags ca
The django.utils.text.smart_split() function used to split template
tag contents seems to strip backslashes. On the other hand, string
literals in variables (like {{"mystring"}}) are passed to the filter
expression parser with backslashes intact.
This complicates things a bit. Forget the part abo
It's confusing that the django.utils.text.smart_split() function un-
escapes quotes and backslashes inside the literal string while
preserving the surrounding quotes:
>>> print ' '.join(smart_split(ur'arg1 "the \"second\" argument"
"the \\third\\ argument"'))
arg1 "the "second" argument
I haven't looked at what your doing real close, but it seems to me
your trying to re-implement the shlex module [1] which has been in the
Python standard library since 1.5.2. Will that do the trick?
[1]: http://docs.python.org/lib/module-shlex.html
On Fri, May 23, 2008 at 10:56 AM, akaihola <[EM