fix for bytearray being passed to blob column
This commit is contained in:
@@ -221,7 +221,7 @@ class Blob(Column):
|
||||
|
||||
def to_database(self, value):
|
||||
|
||||
if not isinstance(value, six.binary_type):
|
||||
if not isinstance(value, (six.binary_type, bytearray)):
|
||||
raise Exception("expecting a binary, got a %s" % type(value))
|
||||
|
||||
val = super(Bytes, self).to_database(value)
|
||||
|
||||
@@ -85,6 +85,12 @@ class TestBlobIO(BaseColumnIOTest):
|
||||
pkey_val = six.b('blake'), uuid4().bytes
|
||||
data_val = six.b('eggleston'), uuid4().bytes
|
||||
|
||||
class TestBlobIO2(BaseColumnIOTest):
|
||||
|
||||
column = columns.Blob
|
||||
pkey_val = bytearray(six.b('blake')), uuid4().bytes
|
||||
data_val = bytearray(six.b('eggleston')), uuid4().bytes
|
||||
|
||||
class TestTextIO(BaseColumnIOTest):
|
||||
|
||||
column = columns.Text
|
||||
|
||||
Reference in New Issue
Block a user