summaryrefslogtreecommitdiff
path: root/django/templatetags
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2018-05-10 17:51:51 +0200
committerGitHub <noreply@github.com>2018-05-10 17:51:51 +0200
commit9c4ea63e878c053600c284e32d5f32d27a59b63a (patch)
treed676a1e98179dd709086214beb3add8a6e9dcff3 /django/templatetags
parent1e20fedb352dde5db2657cad73f998ccdb1aa607 (diff)
Replaced TOKEN_* constants by TokenType enums.
Thanks Tim Graham for the review.
Diffstat (limited to 'django/templatetags')
-rw-r--r--django/templatetags/i18n.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/django/templatetags/i18n.py b/django/templatetags/i18n.py
index b949e459f0..a1dc6e5fd4 100644
--- a/django/templatetags/i18n.py
+++ b/django/templatetags/i18n.py
@@ -1,6 +1,6 @@
from django.conf import settings
from django.template import Library, Node, TemplateSyntaxError, Variable
-from django.template.base import TOKEN_TEXT, TOKEN_VAR, render_value_in_context
+from django.template.base import TokenType, render_value_in_context
from django.template.defaulttags import token_kwargs
from django.utils import translation
from django.utils.safestring import SafeData, mark_safe
@@ -112,9 +112,9 @@ class BlockTranslateNode(Node):
result = []
vars = []
for token in tokens:
- if token.token_type == TOKEN_TEXT:
+ if token.token_type == TokenType.TEXT:
result.append(token.contents.replace('%', '%%'))
- elif token.token_type == TOKEN_VAR:
+ elif token.token_type == TokenType.VAR:
result.append('%%(%s)s' % token.contents)
vars.append(token.contents)
msg = ''.join(result)
@@ -510,7 +510,7 @@ def do_block_translate(parser, token):
plural = []
while parser.tokens:
token = parser.next_token()
- if token.token_type in (TOKEN_VAR, TOKEN_TEXT):
+ if token.token_type in (TokenType.VAR, TokenType.TEXT):
singular.append(token)
else:
break
@@ -519,7 +519,7 @@ def do_block_translate(parser, token):
raise TemplateSyntaxError("'blocktrans' doesn't allow other block tags inside it")
while parser.tokens:
token = parser.next_token()
- if token.token_type in (TOKEN_VAR, TOKEN_TEXT):
+ if token.token_type in (TokenType.VAR, TokenType.TEXT):
plural.append(token)
else:
break