def result_processor(self, dialect):
def process(value):
if value is not None:
+ if util.jython and isinstance(value, array.array):
+ value = value.tostring()
return str(value)
else:
return None
# Py3K
#return loads(value)
# Py2K
- if util.jython and isinstance(value, array.ArrayType):
- value = value.tostring()
- else:
- value = str(value)
- return loads(value)
+ return loads(str(value))
# end Py2K
def copy_value(self, value):
typemap={'pickled':PickleType, 'mypickle':MyPickleType, 'data':Binary, 'data_slice':Binary},
bind=testing.db)
):
- #if util.jython:
- # TODO: may need to modify Binary type directly
- # to detect jython if something other than str()/bytes()
- # is needed to convert from raw to string/bytes.
- # ArrayType should no longer be expected here though.
- # users who want raw ArrayType can of course create their
- # own BinaryType that does no conversion.
- #_eq_data = eq_data
- #def eq_data(x, y):
- # # Jython currently returns arrays
- # from array import ArrayType
- # if isinstance(y, ArrayType):
- # return eq_(x, y.tostring())
- # return _eq_data(x, y)
l = stmt.execute().fetchall()
eq_(stream1, l[0]['data'])
eq_(stream1[0:100], l[0]['data_slice'])