#25000: Implement default __str__ and similar for lazy() objects
----------------------------+--------------------
     Reporter:  knbk        |      Owner:  nobody
         Type:  Bug         |     Status:  new
    Component:  Utilities   |    Version:  master
     Severity:  Normal      |   Keywords:
 Triage Stage:  Unreviewed  |  Has patch:  0
Easy pickings:  0           |      UI/UX:  0
----------------------------+--------------------
 Currently `__str__`  returns the string representation of the proxied
 object only if one of the resultclasses is a string-like object.
 Otherwise, it returns the pretty much useless
 `<django.utils.functional.lazy.<locals>.__proxy__ object at
 0x7fac6332ffd0>`.

 `str(lazy_object)` should return the same as `str(non_lazy_object)`. This
 is easily achievable by providing a default `__str__()` method on
 `__proxy__`:

 {{{
 class __proxy__(Promise):
     def __str__(self):
         return str(self.__cast())
 }}}

 This behaviour would still be overridden for string-like lazy objects. The
 same could be implemented for `bytes()` and `unicode()`.

--
Ticket URL: <https://code.djangoproject.com/ticket/25000>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/047.92c0959a0232591871d5fe5dab199127%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to