From 7f6a41d3d915feb01acfa08b2b936d1199db3ba6 Mon Sep 17 00:00:00 2001 From: Keryn Knight Date: Mon, 7 Jun 2021 20:02:00 +0100 Subject: Fixed #32814 -- Improved performance of TextNode. This avoids calling render() and handling exceptions, which is not necessary for text nodes. --- django/template/base.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'django') diff --git a/django/template/base.py b/django/template/base.py index ed1bae3022..1446cc865e 100644 --- a/django/template/base.py +++ b/django/template/base.py @@ -981,6 +981,15 @@ class TextNode(Node): def render(self, context): return self.s + def render_annotated(self, context): + """ + Return the given value. + + The default implementation of this method handles exceptions raised + during rendering, which is not necessary for text nodes. + """ + return self.s + def render_value_in_context(value, context): """ -- cgit v1.3