Removed unneded str() calls prior to mark_safe(); simplified mark_safe().
This commit is contained in:
parent
c9088cfc7b
commit
857f860d56
|
@ -448,7 +448,7 @@ def safeseq(value):
|
||||||
individually, as safe, after converting them to strings. Return a list
|
individually, as safe, after converting them to strings. Return a list
|
||||||
with the results.
|
with the results.
|
||||||
"""
|
"""
|
||||||
return [mark_safe(str(obj)) for obj in value]
|
return [mark_safe(obj) for obj in value]
|
||||||
|
|
||||||
|
|
||||||
@register.filter(is_safe=True)
|
@register.filter(is_safe=True)
|
||||||
|
|
|
@ -23,7 +23,7 @@ def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='',
|
||||||
use_grouping = use_grouping and grouping != 0
|
use_grouping = use_grouping and grouping != 0
|
||||||
# Make the common case fast
|
# Make the common case fast
|
||||||
if isinstance(number, int) and not use_grouping and not decimal_pos:
|
if isinstance(number, int) and not use_grouping and not decimal_pos:
|
||||||
return mark_safe(str(number))
|
return mark_safe(number)
|
||||||
# sign
|
# sign
|
||||||
sign = ''
|
sign = ''
|
||||||
if isinstance(number, Decimal):
|
if isinstance(number, Decimal):
|
||||||
|
|
|
@ -5,7 +5,7 @@ that the producer of the string has already turned characters that should not
|
||||||
be interpreted by the HTML engine (e.g. '<') into the appropriate entities.
|
be interpreted by the HTML engine (e.g. '<') into the appropriate entities.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.utils.functional import Promise, wraps
|
from django.utils.functional import wraps
|
||||||
|
|
||||||
|
|
||||||
class SafeData:
|
class SafeData:
|
||||||
|
@ -79,8 +79,6 @@ def mark_safe(s):
|
||||||
"""
|
"""
|
||||||
if hasattr(s, '__html__'):
|
if hasattr(s, '__html__'):
|
||||||
return s
|
return s
|
||||||
if isinstance(s, (str, Promise)):
|
|
||||||
return SafeText(s)
|
|
||||||
if callable(s):
|
if callable(s):
|
||||||
return _safety_decorator(mark_safe, s)
|
return _safety_decorator(mark_safe, s)
|
||||||
return SafeText(str(s))
|
return SafeText(s)
|
||||||
|
|
Loading…
Reference in New Issue