diff options
| author | Keryn Knight <keryn@kerynknight.com> | 2021-06-07 12:56:50 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-06-11 12:22:06 +0200 |
| commit | 854e9b066850b9b4eb1171966e996322b2c16d27 (patch) | |
| tree | 966d56419980921b2c30d27d25df270a64bf3b67 /tests/template_tests | |
| parent | 2dfc1066a0d31c7e443e1c7b8590b101a645bf2d (diff) | |
Fixed #32824 -- Improved performance of NodeList.render().
This avoids the following:
- checking that each item in the nodelist is a subclass of Node,
- calling str() on the render_annotated() output, because it's
documented that Node.render() must return a string,
- calling mark_safe() on the output, when the value to be wrapped is
definitively known to be a string because the result of ''.join()
is always of that type,
- using an intermediate list to store each individual string.
Diffstat (limited to 'tests/template_tests')
| -rw-r--r-- | tests/template_tests/templatetags/custom.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/template_tests/templatetags/custom.py b/tests/template_tests/templatetags/custom.py index da7dd0a878..8efd70147a 100644 --- a/tests/template_tests/templatetags/custom.py +++ b/tests/template_tests/templatetags/custom.py @@ -198,4 +198,4 @@ class CounterNode(template.Node): def render(self, context): count = self.count self.count = count + 1 - return count + return str(count) |
