#19954: Storing of Binary fields leads to Exceptions -------------------------------------+------------------------------------- Reporter: marcel.ryser.ch@… | Owner: nobody Type: Bug | Status: new Component: Database layer | Version: 1.5 (models, ORM) | Resolution: Severity: Normal | Triage Stage: Accepted Keywords: | Needs documentation: 0 Has patch: 0 | Patch needs improvement: 0 Needs tests: 0 | UI/UX: 0 Easy pickings: 0 | -------------------------------------+------------------------------------- Changes (by claudep):
* needs_docs: => 0 * needs_better_patch: => 0 * needs_tests: => 0 * stage: Unreviewed => Accepted Comment: I'm about to commit the `BinaryField` patch from #2417. I've tested and reproduced your issue. I found another way to workaround it: {{{ import binascii try: return cursor._last_executed.decode('utf-8') except UnicodeDecodeError: return binascii.b2a_qp(cursor._last_executed) }}} This gives something like {{{ INSERT INTO `model_fields_datamodel` (`short_data`, `data`) VALUES ('=08', =\n'\\0F=FE') }}} The quoted-printable representation of the binary parameters may not be the best representation, but at least it doesn't crash. Opinions? -- Ticket URL: <https://code.djangoproject.com/ticket/19954#comment:1> 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 django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.