You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One of the goals of the Debug Toolbar is to display a meaningful textual representation of a variety of objects.
However, depending on the objects, many things can go wrong. Not all objects implement __unicode__ or __str__. These methods may return a value of the wrong type or raise an exception. Attempting to display the exception may trigger an other exception or an infinite recursion.
(To be honest, the infinite recursion in __unicode__ or __str__ is the worst case I know.)
This ticket proposes to standardize how arbitrary objects are converted to text in an utility function and to use it throughout the project.
django.utils.encoding.force_text could be a good start; however, it's constrained by Django's backwards compatibility requirements and may not have all the features we desire.
The text was updated successfully, but these errors were encountered:
This function, or a sister function, should also handle pretty-printing and indentation. Two issues suggest improving representation of objects in panels: #358 and #371.
<code>{{ value|pprint }}</code> in the templates seems to work quite well.
Non-ascii characters are escaped eg. \xe9 under Python 2, which is less readable, but not a bad compromise given the variety of crashing bugs we've had in the past.
One of the goals of the Debug Toolbar is to display a meaningful textual representation of a variety of objects.
However, depending on the objects, many things can go wrong. Not all objects implement
__unicode__
or__str__
. These methods may return a value of the wrong type or raise an exception. Attempting to display the exception may trigger an other exception or an infinite recursion.(To be honest, the infinite recursion in
__unicode__
or__str__
is the worst case I know.)This ticket proposes to standardize how arbitrary objects are converted to text in an utility function and to use it throughout the project.
django.utils.encoding.force_text
could be a good start; however, it's constrained by Django's backwards compatibility requirements and may not have all the features we desire.The text was updated successfully, but these errors were encountered: