1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

[1.7.x] Fixed an inconsistency introduced in 547b1810.

mark_safe and mark_for_escaping should have been kept similar.

On Python 2 this change has no effect. On Python 3 it fixes the use case
shown in the regression test for mark_for_escaping, which used to raise
a TypeError. The regression test for mark_safe is just for completeness.

Backport of 5c5eb5fe from master.
This commit is contained in:
Aymeric Augustin
2014-12-23 21:49:05 +01:00
parent a79012f6d8
commit b429a9796a
3 changed files with 22 additions and 1 deletions

View File

@@ -144,4 +144,4 @@ def mark_for_escaping(s):
return EscapeBytes(s)
if isinstance(s, (six.text_type, Promise)):
return EscapeText(s)
return EscapeBytes(bytes(s))
return EscapeString(str(s))