Search code examples
pythondjangodjango-debug-toolbar

django-debug-toolbar blows up when saving binary object in db. Is there a workaround?


I'm using the django-debug-toolbar, and when I try to save something in a blob field I get:

DjangoUnicodeDecodeError

looking through the stack trace it come from:

django_debug_toolbar-0.8.4-py2.6.egg/debug_toolbar/panels/sql.py in execute
98. _params = simplejson.dumps([force_unicode(x, strings_only=True) for x in params]) 

Is there any workaround to this issue? (besides saving the binary object somewhere on the file system)


Solution

  • My thought would be to break out that list comprehension into a traditional for loop, and wrap a try/except around it so it doesn't throw an exception. In the except clause, simply add something like "Non-unicode object" for the output.

    There is nothing currently built-in to work around this, sorry.