#4164: Inaccurate tags recognition
------------------------------------------+---------------------------------
   Reporter:  tonnzor <[EMAIL PROTECTED]>  |                Owner:  anonymous   
   
     Status:  assigned                    |            Component:  Template 
system
    Version:  SVN                         |           Resolution:               
  
   Keywords:                              |                Stage:  Accepted     
  
  Has_patch:  0                           |           Needs_docs:  0            
  
Needs_tests:  0                           |   Needs_better_patch:  0            
  
------------------------------------------+---------------------------------
Changes (by tonnzor <[EMAIL PROTECTED]>):

  * owner:  adrian => anonymous
  * status:  new => assigned

Comment:

 @Thomas Steinacher:
 
 No. This template will be processed:
 
  1. Splitted by tag_re regular expression (result: ['{{ "some text" #}',]
  2. Parsed by Lexer.tokenize (result: ['{{ "some text" #}'])
  3. Parsed by Lexer.create_token
 
 Code for step 3:
 {{{
         if token_string.startswith(VARIABLE_TAG_START):
             token = Token(TOKEN_VAR,
 token_string[len(VARIABLE_TAG_START):-len(VARIABLE_TAG_END)].strip())
         elif token_string.startswith(BLOCK_TAG_START):
             token = Token(TOKEN_BLOCK,
 token_string[len(BLOCK_TAG_START):-len(BLOCK_TAG_END)].strip())
         elif token_string.startswith(COMMENT_TAG_START):
             token = Token(TOKEN_COMMENT, '')
         else:
             token = Token(TOKEN_TEXT, token_string)
 }}}
 
 As you see - only the beginning is checked, and tag's end is cut (any 2
 chars).
 
 Provided example is edge case, but this bug can cause very strange errors.
 I can provide move examples if needed.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/4164#comment:3>
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to