#5971: django.template.TokenParser inconsistent with parsing filters
-------------------------------------------------------+--------------------
Reporter: Dmitri Fedortchenko <[EMAIL PROTECTED]> | Owner:
nobody
Status: new | Component:
Template system
Version: SVN | Resolution:
Keywords: template filter | Stage:
Accepted
Has_patch: 1 | Needs_docs:
0
Needs_tests: 0 | Needs_better_patch:
0
-------------------------------------------------------+--------------------
Changes (by mtredinnick):
* stage: Unreviewed => Accepted
Old description:
> django.template.TokenParser is inconsistent
> when parsing filters that follow constant strings or variables.
>
> Meaning that:
> {% tag thevar|filter sometag %} will produce:
> self.value() = "thevar|filter"
> self.tag() = "sometag"
>
> However:
> {% tag "a value"|filter sometag %} will produce:
> self.value() = "a value"
> self.tag() = "|filter"
> self.tag() = "sometag"
>
> This does not seem like correct behaviour...
> I made a very simple patch for this, thus the outcome of the above:
>
> {% tag "a value"|filter sometag %} will produce:
> value = "a value"|filter
> tag = sometag
>
> So now we can simply pass the "value" into a FilterExpression to parse
> the filters...
>
> PS: I had trouble naming an internal method, feel free to complain about
> the name ;)
New description:
django.template.TokenParser is inconsistent
when parsing filters that follow constant strings or variables.
Meaning that:
{{{
#!python
{% tag thevar|filter sometag %}
}}}
will produce:
{{{
#!python
self.value() = "thevar|filter"
self.tag() = "sometag"
}}}
However:
{{{
#!python
{% tag "a value"|filter sometag %}
}}}
will produce:
{{{
#!python
self.value() = "a value"
self.tag() = "|filter"
self.tag() = "sometag"
}}}
This does not seem like correct behaviour...
I made a very simple patch for this, thus the outcome of the above:
{{{
#!python
{% tag "a value"|filter sometag %}
}}}
will produce:
{{{
#!python
value = "a value"|filter
tag = sometag
}}}
So now we can simply pass the "value" into a !FilterExpression to parse
the filters...
PS: I had trouble naming an internal method, feel free to complain about
the name ;)
Comment:
Fixed description formatting.
--
Ticket URL: <http://code.djangoproject.com/ticket/5971#comment:2>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---