Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #2961 -- Added 'opencomment' and 'closecomment' options to {% t…

…emplatetag %} templatetag. Thanks for the patch, Jeong-Min Lee

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3938 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 48234a0925fcba67a72d3cfc31fbf66cca3f2e33 1 parent ed27ff9
Adrian Holovaty authored October 27, 2006
2  AUTHORS
@@ -106,7 +106,7 @@ answer newbie questions, and generally made Django that much better:
106 106
     lakin.wecker@gmail.com
107 107
     Stuart Langridge <http://www.kryogenix.org/>
108 108
     Eugene Lazutkin <http://lazutkin.com/blog/>
109  
-    Jeong-Min Lee
  109
+    Jeong-Min Lee <falsetru@gmail.com>
110 110
     Christopher Lenz <http://www.cmlenz.net/>
111 111
     lerouxb@gmail.com
112 112
     limodou
6  django/template/defaulttags.py
... ...
@@ -1,7 +1,7 @@
1 1
 "Default tags used by the template system, available to all templates."
2 2
 
3 3
 from 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
  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, COMMENT_TAG_START, COMMENT_TAG_END
5 5
 from django.template import get_library, Library, InvalidTemplateLibrary
6 6
 from django.conf import settings
7 7
 import sys
@@ -295,6 +295,8 @@ class TemplateTagNode(Node):
295 295
                'closevariable': VARIABLE_TAG_END,
296 296
                'openbrace': SINGLE_BRACE_START,
297 297
                'closebrace': SINGLE_BRACE_END,
  298
+               'opencomment': COMMENT_TAG_START,
  299
+               'closecomment': COMMENT_TAG_END,
298 300
                }
299 301
 
300 302
     def __init__(self, tagtype):
@@ -831,6 +833,8 @@ def templatetag(parser, token):
831 833
         ``closevariable``   ``}}``
832 834
         ``openbrace``       ``{``
833 835
         ``closebrace``      ``}``
  836
+        ``opencomment``     ``{#``
  837
+        ``closecomment``    ``#}``
834 838
         ==================  =======
835 839
     """
836 840
     bits = token.contents.split()
4  docs/templates.txt
@@ -800,8 +800,12 @@ The argument tells which template bit to output:
800 800
     ``closevariable``   ``}}``
801 801
     ``openbrace``       ``{``
802 802
     ``closebrace``      ``}``
  803
+    ``opencomment``     ``{#``
  804
+    ``closecomment``    ``#}``
803 805
     ==================  =======
804 806
 
  807
+Note: ``opencomment`` and ``closecomment`` are new in the Django development version.
  808
+
805 809
 widthratio
806 810
 ~~~~~~~~~~
807 811
 
2  tests/regressiontests/templates/tests.py
@@ -552,6 +552,8 @@ def test_templates(self):
552 552
             'templatetag08': ('{% templatetag closebrace %}', {}, '}'),
553 553
             'templatetag09': ('{% templatetag openbrace %}{% templatetag openbrace %}', {}, '{{'),
554 554
             'templatetag10': ('{% templatetag closebrace %}{% templatetag closebrace %}', {}, '}}'),
  555
+            'templatetag11': ('{% templatetag opencomment %}', {}, '{#'),
  556
+            'templatetag12': ('{% templatetag closecomment %}', {}, '#}'),
555 557
 
556 558
             ### WIDTHRATIO TAG ########################################################
557 559
             'widthratio01': ('{% widthratio a b 0 %}', {'a':50,'b':100}, '0'),

0 notes on commit 48234a0

Please sign in to comment.
Something went wrong with that request. Please try again.