IPython session, which demonstrates code broken because of that:
{{{
In [1]: from django.utils.functional import lazy
In [2]: from django.utils.encoding import force_text
In [3]: from django.utils import six
In [4]: from django.utils.html import strip_tags
In [5]: promise = lazy(lambda:u'hello', six.text_type)()
In [6]: force_text(promise)
Out[6]: u'hello'
In [7]: promise = lazy(lambda:u'hello', six.text_type)()
In [8]: stripped = strip_tags(promise)
In [9]: force_text(stripped)
Out[9]: u'<django.utils.functional.__proxy__ object at 0x101f6ca50>'
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/20222>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
Thanks to bmispelon for pointing that out.
--
Ticket URL: <https://code.djangoproject.com/ticket/20222#comment:1>
* cc: bmispelon@… (added)
* easy: 0 => 1
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/20222#comment:2>
* status: new => assigned
* owner: nobody => bmispelon
Comment:
I've started working on this on my branch:
https://github.com/bmispelon/django/compare/allow-lazy-refactor
I hope to fix #20221 and #20223 along with this one.
--
Ticket URL: <https://code.djangoproject.com/ticket/20222#comment:3>
Comment (by bmispelon):
I've prepared a pull request for this ticket that include fixes for 3
other ones: https://github.com/django/django/pull/1007
--
Ticket URL: <https://code.djangoproject.com/ticket/20222#comment:4>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/20222#comment:5>
* needs_better_patch: 0 => 1
* easy: 1 => 0
Comment:
No longer merges cleanly.
--
Ticket URL: <https://code.djangoproject.com/ticket/20222#comment:6>
* needs_better_patch: 1 => 0
Comment:
I've updated bmispelon's patch so it merges cleanly as a pull request
4202:
https://github.com/django/django/pull/4202
--
Ticket URL: <https://code.djangoproject.com/ticket/20222#comment:7>
* needs_better_patch: 0 => 1
Comment:
Comments for improvement on the PR.
--
Ticket URL: <https://code.djangoproject.com/ticket/20222#comment:8>
* status: assigned => closed
* resolution: => fixed
Comment:
Correct me if I'm wrong, but based on the sample shell session, I think
this is fixed by #25000.
--
Ticket URL: <https://code.djangoproject.com/ticket/20222#comment:9>