Changes between Initial Version and Version 2 of Ticket #20812


Ignore:
Timestamp:
Aug 19, 2013, 11:29:53 AM (11 years ago)
Author:
Tim Graham
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #20812 – Description

    initial v2  
    1 Unlike the unicode() builtin function, the method __unicode__() does not.
     1Unlike the `unicode()` builtin function, the method `__unicode__()` does not validate its return type.
    22
    3 If people wrote a buggy __unicode__ which does not return str or unicode, this can lead to a situation where force_text() will return non-text, and so the bug may only appear much, much later when other parts of the application assumes they were getting text and often it will become very difficult to find how the non-string object came from.
     3If people wrote a buggy `__unicode__` which does not return `str` or `unicode`, this can lead to a situation where `force_text()` will return non-text, and so the bug may only appear much, much later when other parts of the application assumes they were getting text and often it will become very difficult to find how the non-string object came from.
    44
    55Expected result:
    66
    7 force_text() should be switched to use unicode() so returning non-text from __unicode__() will immediately raise an error at the point where the error would have been obvious.
     7`force_text()` should be switched to use `unicode()` so returning non-text from `__unicode__()` will immediately raise an error at the point where the error would have been obvious.
Back to Top