﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
23536	BinaryField on mysql gets retrieved as 'str', not as 'bytes'	fbrau	nobody	"I have a project that uses BinaryFields to pickle dynamic data.

Last week when migrating from sqlite to mysql 
using MySQL-for-Python-3 the BinaryField now gets
retrieved as 'str'. 

Reading the docs about BinaryField it says it is stored as 'bytes'.

I know mysql stores blobs
as text (right?) but in that case the problem is django's
documentation.

In this particular case:
the attribute mymodel.myblob looked like: b'dadadadaa'
but type(mymodel.myblob) said it was a 'str'
(I'm bit outdated about latest python changes in strings, bytes
 and unicode)

Anyways I had to bypass this different behaviour to act just
like the embedded sqlite driver. My 'solution' is not nice:
* I had to reparse the string to make it a 'bytes':
   >>> self._tags = eval('b""'+self.tags[2:-1]+'""')
* And add proxy points to get and set the blob

The code is located at:
[https://code.google.com/p/tidy-django-models/source/diff?spec=svn2dd52f4b6600c58b9a970cdcebfaf0b725cd0961&r=2dd52f4b6600c58b9a970cdcebfaf0b725cd0961&format=side&path=/tdmodels/tagged.py]"	Bug	closed	Uncategorized	1.6	Normal	invalid	mysql BinaryField		Unreviewed	0	0	0	0	0	0
