#24836: force_text doesn't force SimpleLazyObject into a string
---------------------------------+------------------------------------
Reporter: riklaunim | Owner: nobody
Type: Bug | Status: new
Component: CSRF | Version: 1.8
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Comment (by timgraham):
I'm not quite sure what the fix would look like, but I think
`force_text()` might need special knowledge of `SimpleLazyObject` if we
were to fix it there, which doesn't seem like a good separation of
concerns. The docstring for `SimpleLazyObject` says, "Designed for
compound objects of unknown type. For builtins or objects of known type,
use django.utils.functional.lazy."
Currently `force_text()` does a `six.text_type()` cast and
`type(force_text(obj)` -> `SimpleLazyObject` if `obj` is a
`SimpleLazyObject`.
--
Ticket URL: <https://code.djangoproject.com/ticket/24836#comment:6>
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/067.c9141a48ecdb50b8c724e13a6d23a917%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.