From dc716112a746916b1ac9ffb092684acd8819572a Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Wed, 28 Nov 2007 20:03:28 +0000 Subject: [PATCH] Fixed an edge-case for auto-escaping: if the stringfilter decorator is used and generates a first argument that is a safe string, make the is_safe handling work as expect. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6721 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/template/defaultfilters.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/django/template/defaultfilters.py b/django/template/defaultfilters.py index 76d723e0eb0..e62e2e3eaf4 100644 --- a/django/template/defaultfilters.py +++ b/django/template/defaultfilters.py @@ -25,6 +25,8 @@ def stringfilter(func): if args: args = list(args) args[0] = force_unicode(args[0]) + if isinstance(args[0], SafeData) and getattr(func, 'is_safe', False): + return mark_safe(func(*args, **kwargs)) return func(*args, **kwargs) # Include a reference to the real function (used to check original