#4164: Inaccurate tags recognition
------------------------------------------+---------------------------------
Reporter: tonnzor <[EMAIL PROTECTED]> | Owner: adrian
Status: new | Component: Template
system
Version: SVN | Resolution:
Keywords: | Stage: Accepted
Has_patch: 0 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 0
------------------------------------------+---------------------------------
Changes (by mtredinnick):
* has_patch: 1 => 0
* stage: Unreviewed => Accepted
Comment:
There is an interesting problem going on here, but it's a little bit
bigger than this patch. The patch only works if the broken template is the
whole "token_string" contents. Having any extra trailing characters would
land you right back in the initial problem. Removing the "has patch"
designator for that reason.
The bug itself is only triggered if the very first characters of a string
of characters that do not contain a real tag match could be the beginning
of a match. Again, putting any random character at the start of the string
hides the problem. There is also a problem with typos like
{{{
{{ foo #} {{ blah }}
}}}
That will try to resolve a variable called "foo #} {{ blah", rather than
just spitting out the first bit unchanged and then treating the `{{ blah
}}` portion as a well-formed tag.
I'm working on a slight change to the matching expression that should fix
all of these problems without any real performance impact.
Thomas: it's a bit of a coin toss whether this should be treated as a
syntax error or not. One problem with doing so is that it would make
passing the (somewhat improbable) string "}}" as an argument to a tag
problematic. At the moment we display any malformed input like this
literally in the resulting template, so it's easy to pick up by eye. I'm
not completely unhappy with that behaviour.
--
Ticket URL: <http://code.djangoproject.com/ticket/4164#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
-~----------~----~----~----~------~----~------~--~---