summaryrefslogtreecommitdiff
path: root/django/templatetags
diff options
context:
space:
mode:
authorKeryn Knight <keryn@kerynknight.com>2021-07-06 14:53:03 +0100
committerKeryn Knight <keryn@kerynknight.com>2021-08-02 10:57:51 +0100
commitedf184dd067e676962e8e1fc1a50397b810461d6 (patch)
treee70d6e44b8466906a0f23719f316a02b127e2736 /django/templatetags
parent34d5336b9deed41c6b61989f8cd755e9d179ce4c (diff)
downloaddjango-edf184dd067e676962e8e1fc1a50397b810461d6.tar.gz
Fixed #32919 -- Optimized lexing & parsing of templates.
This optimizes: - Lexer.create_token() by avoiding startswith() calls, - Parser.parse() by re-using the token type enum's value, - Parser.extend_nodelist() by removing unnecessary isinstance() check, - some Node subclasses by removing the implicit "nodelist" from "child_nodelists", - Variable.__init__() by avoiding startswith() calls.
Diffstat (limited to 'django/templatetags')
-rw-r--r--django/templatetags/i18n.py2
-rw-r--r--django/templatetags/static.py2
2 files changed, 4 insertions, 0 deletions
diff --git a/django/templatetags/i18n.py b/django/templatetags/i18n.py
index 60d8c8046b..8c123c7dd5 100644
--- a/django/templatetags/i18n.py
+++ b/django/templatetags/i18n.py
@@ -68,6 +68,8 @@ class GetCurrentLanguageBidiNode(Node):
class TranslateNode(Node):
+ child_nodelists = ()
+
def __init__(self, filter_expression, noop, asvar=None,
message_context=None):
self.noop = noop
diff --git a/django/templatetags/static.py b/django/templatetags/static.py
index 71271d2410..4d1a05ee03 100644
--- a/django/templatetags/static.py
+++ b/django/templatetags/static.py
@@ -91,6 +91,8 @@ def get_media_prefix(parser, token):
class StaticNode(template.Node):
+ child_nodelists = ()
+
def __init__(self, varname=None, path=None):
if path is None:
raise template.TemplateSyntaxError(