Code

Ticket #5945: safe_constants.diff

File safe_constants.diff, 941 bytes (added by SmileyChris, 6 years ago)
Line 
1Index: django/template/__init__.py
2===================================================================
3--- django/template/__init__.py (revision 6674)
4+++ django/template/__init__.py (working copy)
5@@ -594,7 +594,7 @@
6             arg_vals = []
7             for lookup, arg in args:
8                 if not lookup:
9-                    arg_vals.append(arg)
10+                    arg_vals.append(mark_safe(arg))
11                 else:
12                     arg_vals.append(arg.resolve(context))
13             if getattr(func, 'needs_autoescape', False):
14@@ -701,7 +701,7 @@
15             # If it's wrapped with quotes (single or double), then
16             # we're also dealing with a literal.
17             if var[0] in "\"'" and var[0] == var[-1]:
18-                self.literal = var[1:-1]
19+                self.literal = mark_safe(var[1:-1])
20 
21             else:
22                 # Otherwise we'll set self.lookups so that resolve() knows we're