diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2006-06-18 04:12:55 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2006-06-18 04:12:55 +0000 |
| commit | 75a8a32f8629b47135890ac6ecda061a616d1cfc (patch) | |
| tree | b0bd5f35ffd7c1d48e334b41517b8a55ad11795d /django | |
| parent | 4540a85ddabd9303955b88f5f727a7ede6161253 (diff) | |
Fixed #2181 -- allow '{' and '}' to be escaped via {% templatetag ... %}.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3138 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/template/__init__.py | 2 | ||||
| -rw-r--r-- | django/template/defaulttags.py | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/django/template/__init__.py b/django/template/__init__.py index 028d23f251..08f433fec9 100644 --- a/django/template/__init__.py +++ b/django/template/__init__.py @@ -75,6 +75,8 @@ BLOCK_TAG_START = '{%' BLOCK_TAG_END = '%}' VARIABLE_TAG_START = '{{' VARIABLE_TAG_END = '}}' +SINGLE_BRACE_START = '{' +SINGLE_BRACE_END = '}' ALLOWED_VARIABLE_CHARS = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.' diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py index 50a6da68f4..8b52b70cda 100644 --- a/django/template/defaulttags.py +++ b/django/template/defaulttags.py @@ -1,7 +1,7 @@ "Default tags used by the template system, available to all templates." from django.template import Node, NodeList, Template, Context, resolve_variable -from django.template import TemplateSyntaxError, VariableDoesNotExist, BLOCK_TAG_START, BLOCK_TAG_END, VARIABLE_TAG_START, VARIABLE_TAG_END +from django.template import TemplateSyntaxError, VariableDoesNotExist, BLOCK_TAG_START, BLOCK_TAG_END, VARIABLE_TAG_START, VARIABLE_TAG_END, SINGLE_BRACE_START, SINGLE_BRACE_END from django.template import get_library, Library, InvalidTemplateLibrary from django.conf import settings import sys @@ -275,7 +275,10 @@ class TemplateTagNode(Node): mapping = {'openblock': BLOCK_TAG_START, 'closeblock': BLOCK_TAG_END, 'openvariable': VARIABLE_TAG_START, - 'closevariable': VARIABLE_TAG_END} + 'closevariable': VARIABLE_TAG_END, + 'openbrace': SINGLE_BRACE_START, + 'closebrace': SINGLE_BRACE_END, + } def __init__(self, tagtype): self.tagtype = tagtype @@ -809,6 +812,8 @@ def templatetag(parser, token): ``closeblock`` ``%}`` ``openvariable`` ``{{`` ``closevariable`` ``}}`` + ``openbrace`` ``{`` + ``closebrace`` ``}`` ================== ======= """ bits = token.contents.split() |
