Django

Code

Changeset 3138

Show
Ignore:
Timestamp:
06/17/06 23:12:55 (2 years ago)
Author:
mtredinnick
Message:

Fixed #2181 -- allow '{' and '}' to be escaped via {% templatetag ... %}.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/template/defaulttags.py

    r3112 r3138  
    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 
     4from django.template import TemplateSyntaxError, VariableDoesNotExist, BLOCK_TAG_START, BLOCK_TAG_END, VARIABLE_TAG_START, VARIABLE_TAG_END, SINGLE_BRACE_START, SINGLE_BRACE_END 
    55from django.template import get_library, Library, InvalidTemplateLibrary 
    66from django.conf import settings 
     
    276276               'closeblock': BLOCK_TAG_END, 
    277277               'openvariable': VARIABLE_TAG_START, 
    278                'closevariable': VARIABLE_TAG_END} 
     278               'closevariable': VARIABLE_TAG_END, 
     279               'openbrace': SINGLE_BRACE_START, 
     280               'closebrace': SINGLE_BRACE_END, 
     281               } 
    279282 
    280283    def __init__(self, tagtype): 
     
    810813        ``openvariable``    ``{{`` 
    811814        ``closevariable``   ``}}`` 
     815        ``openbrace``       ``{`` 
     816        ``closebrace``      ``}`` 
    812817        ==================  ======= 
    813818    """ 
  • django/trunk/django/template/__init__.py

    r3113 r3138  
    7676VARIABLE_TAG_START = '{{' 
    7777VARIABLE_TAG_END = '}}' 
     78SINGLE_BRACE_START = '{' 
     79SINGLE_BRACE_END = '}' 
    7880 
    7981ALLOWED_VARIABLE_CHARS = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.' 
  • django/trunk/docs/templates.txt

    r3108 r3138  
    767767    ``openvariable``    ``{{`` 
    768768    ``closevariable``   ``}}`` 
     769    ``openbrace``       ``{`` 
     770    ``closebrace``      ``}`` 
    769771    ==================  ======= 
    770772 
  • django/trunk/tests/othertests/templates.py

    r3113 r3138  
    500500    'templatetag05': ('{% templatetag %}', {}, template.TemplateSyntaxError), 
    501501    'templatetag06': ('{% templatetag foo %}', {}, template.TemplateSyntaxError), 
     502    'templatetag07': ('{% templatetag openbrace %}', {}, '{'), 
     503    'templatetag08': ('{% templatetag closebrace %}', {}, '}'), 
     504    'templatetag09': ('{% templatetag openbrace %}{% templatetag openbrace %}', {}, '{{'), 
     505    'templatetag10': ('{% templatetag closebrace %}{% templatetag closebrace %}', {}, '}}'), 
    502506 
    503507    ### WIDTHRATIO TAG ########################################################