Ticket #1176: comment_without_parse_r1831.diff

File comment_without_parse_r1831.diff, 1.2 KB (added by django@…, 18 years ago)

Comment tag without building nodelist

  • django/core/template/__init__.py

     
    311311            self.unclosed_block_tag(parse_until)
    312312        return nodelist
    313313
     314    def skip_past(self, endtag):
     315        while self.tokens:
     316            token = self.next_token()
     317            if token.token_type == TOKEN_BLOCK:
     318                if token.contents == endtag:
     319                    return
     320        self.unclosed_block_tag([endtag])
     321
    314322    def create_variable_node(self, filter_expression):
    315323        return VariableNode(filter_expression)
    316324
  • django/core/template/defaulttags.py

     
    286286    """
    287287    Ignore everything between ``{% comment %}`` and ``{% endcomment %}``
    288288    """
    289     nodelist = parser.parse(('endcomment',))
    290     parser.delete_first_token()
     289    nodelist = parser.skip_past('endcomment')
    291290    return CommentNode()
    292291comment = register.tag(comment)
    293292
Back to Top