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
This commit is contained in:
Malcolm Tredinnick 2007-11-28 20:03:28 +00:00
parent 2d0d6620e6
commit dc716112a7
1 changed files with 2 additions and 0 deletions

View File

@ -25,6 +25,8 @@ def stringfilter(func):
if args: if args:
args = list(args) args = list(args)
args[0] = force_unicode(args[0]) 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) return func(*args, **kwargs)
# Include a reference to the real function (used to check original # Include a reference to the real function (used to check original