Ticket #2961: templatetag-comment.patch

File templatetag-comment.patch, 2.3 KB (added by Jeong-Min Lee <falsetru@…>, 18 years ago)

patch including test against 3937

  • django/template/defaulttags.py

     
    11"Default tags used by the template system, available to all templates."
    22
    33from django.template import Node, NodeList, Template, Context, resolve_variable
    4 from django.template import TemplateSyntaxError, VariableDoesNotExist, BLOCK_TAG_START, BLOCK_TAG_END, VARIABLE_TAG_START, VARIABLE_TAG_END, SINGLE_BRACE_START, SINGLE_BRACE_END
     4from django.template import TemplateSyntaxError, VariableDoesNotExist, BLOCK_TAG_START, BLOCK_TAG_END, VARIABLE_TAG_START, VARIABLE_TAG_END, SINGLE_BRACE_START, SINGLE_BRACE_END, COMMENT_TAG_START, COMMENT_TAG_END
    55from django.template import get_library, Library, InvalidTemplateLibrary
    66from django.conf import settings
    77import sys
     
    295295               'closevariable': VARIABLE_TAG_END,
    296296               'openbrace': SINGLE_BRACE_START,
    297297               'closebrace': SINGLE_BRACE_END,
     298               'opencomment': COMMENT_TAG_START,
     299               'closecomment': COMMENT_TAG_END,
    298300               }
    299301
    300302    def __init__(self, tagtype):
     
    831833        ``closevariable``   ``}}``
    832834        ``openbrace``       ``{``
    833835        ``closebrace``      ``}``
     836        ``opencomment``     ``{#``
     837        ``closecomment``    ``#}``
    834838        ==================  =======
    835839    """
    836840    bits = token.contents.split()
  • tests/regressiontests/templates/tests.py

     
    552552            'templatetag08': ('{% templatetag closebrace %}', {}, '}'),
    553553            'templatetag09': ('{% templatetag openbrace %}{% templatetag openbrace %}', {}, '{{'),
    554554            'templatetag10': ('{% templatetag closebrace %}{% templatetag closebrace %}', {}, '}}'),
     555            'templatetag11': ('{% templatetag opencomment %}', {}, '{#'),
     556            'templatetag12': ('{% templatetag closecomment %}', {}, '#}'),
    555557
    556558            ### WIDTHRATIO TAG ########################################################
    557559            'widthratio01': ('{% widthratio a b 0 %}', {'a':50,'b':100}, '0'),
Back to Top