#8296: Allow template parser to parse until "complex" block node
---------------------------------------------+------------------------------
          Reporter:  julien                  |         Owner:  nobody
            Status:  new                     |     Milestone:        
         Component:  Template system         |       Version:  SVN   
        Resolution:                          |      Keywords:        
             Stage:  Design decision needed  |     Has_patch:  1     
        Needs_docs:  0                       |   Needs_tests:  0     
Needs_better_patch:  0                       |  
---------------------------------------------+------------------------------
Changes (by adurdin):

 * cc: [email protected] (added)

Comment:

 In the meantime, here's a slightly ugly workaround that you can put in
 your tag:
 {{{
     class BlockTagList(object):
         # This is a bit of a hack, as it embeds knowledge of the behaviour
         # of Parser.parse() relating to the "parse_until" argument.
         def __init__(self, *names):
             self.names = set(names)
         def __contains__(self, token_contents):
             name = token_contents.split()[0]
             return name in self.names

     # Skip over everything before the first {% case %} tag
     parser.parse(BlockTagList('case', 'endswitch'))
 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/8296#comment:4>
Django <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