Add conversion checking on the value of a seq column

This commit is contained in:
2016-05-29 12:54:13 +02:00
parent a8ed57dc6e
commit 2e35229357

View File

@ -94,10 +94,16 @@ cdef class OBIDMS_column_multi_elts_seq(OBIDMS_column_multi_elts):
cpdef set_item(self, index_t line_nb, str element_name, object value):
cdef bytes value_b
if value is None :
value_b = OBISeq_NA
else :
elif isinstance(value, bytes) :
value_b = value
elif isinstance(value, str) :
value_b = str2bytes(value)
else:
raise TypeError('Sequence value must be of type Bytes, Str or None')
if obi_column_set_obiseq_with_elt_name_in_view(self.view.pointer, (self.pointer)[0], line_nb, str2bytes(element_name), value_b) < 0:
raise Exception("Problem setting a value in a column")