Changes between Initial Version and Version 1 of Ticket #31203
- Timestamp:
- Jan 23, 2020, 7:28:42 PM (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #31203 – Description
initial v1 1 1 Not 100% positive this is a bug, but definitely a breaking change in Django. 2 2 3 In 1.11 ValidationError used force_text to stringify its messages, but in 2.2 and 3.0, it's using str.3 In 1.11 `ValidationError` used `force_text` to stringify its messages, but in 2.2 and 3.0, it's using `str`. 4 4 5 force_text used to check for subtypes of six.text_type and let those through unchanged, whereas str forces the __str__conversion.5 `force_text` used to check for subtypes of `six.text_type` and let those through unchanged, whereas str forces the `__str__` conversion. 6 6 7 This interacts poorly with Markup, which 'unwraps' itself in the __str__method. Here's a sample problem:7 This interacts poorly with Markup, which 'unwraps' itself in the `__str__` method. Here's a sample problem: 8 8 9 9 … … 19 19 That error should render on a form as a span followed by some text; however, the use of str causes the 'safeness' of the markup to be lost and thus it's re-escaped and the HTML leaks into the page. 20 20 21 Maybe Markup should be returning self in __str__, since it's a __str__subclass. This bug can be worked around from client code using something like this:21 Maybe Markup should be returning self in `__str__`, since it's a `__str__` subclass. This bug can be worked around from client code using something like this: 22 22 23 23