Changes between Initial Version and Version 1 of Ticket #31203


Ignore:
Timestamp:
Jan 23, 2020, 7:28:42 PM (4 years ago)
Author:
Felipe
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #31203 – Description

    initial v1  
    11Not 100% positive this is a bug, but definitely a breaking change in Django.
    22
    3 In 1.11 ValidationError used force_text to stringify its messages, but in 2.2 and 3.0, it's using str.
     3In 1.11 `ValidationError` used `force_text` to stringify its messages, but in 2.2 and 3.0, it's using `str`.
    44
    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.
    66
    7 This interacts poorly with Markup, which 'unwraps' itself in the __str__ method. Here's a sample problem:
     7This interacts poorly with Markup, which 'unwraps' itself in the `__str__` method. Here's a sample problem:
    88
    99
     
    1919That 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.
    2020
    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:
     21Maybe 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:
    2222
    2323
Back to Top