Added (temporary?) check for the type of quality strings because the

import now seems to return them with bytes type
This commit is contained in:
Celine Mercier
2016-08-10 16:25:45 +02:00
parent 4ba01617af
commit bea02cc7a5

View File

@ -70,11 +70,16 @@ cdef class OBIDMS_column_qual(OBIDMS_column):
free(value_b) free(value_b)
cpdef set_str_line(self, index_t line_nb, object value): cpdef set_str_line(self, index_t line_nb, object value):
cdef bytes value_b
if value is None : if value is None :
if obi_set_qual_char_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, OBIQual_char_NA) < 0: if obi_set_qual_char_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, OBIQual_char_NA) < 0:
raise Exception("Problem setting a value in a column") raise Exception("Problem setting a value in a column")
else : else :
if obi_set_qual_char_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, str2bytes(value)) < 0: if type(value) == str:
value_b = str2bytes(value)
else :
value_b = value
if obi_set_qual_char_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, value_b) < 0:
raise Exception("Problem setting a value in a column") raise Exception("Problem setting a value in a column")