Cython API: trying to guess the type of a column when adding a None
value does not generate an exception anymore, and RollbackException can now rollback several views
This commit is contained in:
@ -444,9 +444,12 @@ cdef class Line :
|
||||
|
||||
# TODO use functions in utils
|
||||
|
||||
#print(column_name, "value:", value, type(value))
|
||||
|
||||
if column_name_b not in self._view :
|
||||
if value == None :
|
||||
raise RollbackException("Trying to create a column from a None value (can't guess type)", self)
|
||||
if value is None :
|
||||
return # TODO discuss. This means that columns aren't created until an identifiable type is found
|
||||
#raise RollbackException("Trying to create a column from a None value (can't guess type)", self)
|
||||
value_type = type(value)
|
||||
if value_type == int :
|
||||
value_obitype = OBI_INT
|
||||
@ -636,8 +639,10 @@ cdef class Line_selection(list):
|
||||
|
||||
|
||||
class RollbackException(Exception):
|
||||
def __init__(self, message, View view):
|
||||
def __init__(self, message, *views):
|
||||
super(RollbackException, self).__init__(message)
|
||||
for i in range(len(views)):
|
||||
view = <View>(views[i])
|
||||
if obi_rollback_view(<Obiview_p>(view.pointer())) < 0 :
|
||||
raise Exception("Error rollbacking view")
|
||||
if view.active() :
|
||||
|
Reference in New Issue
Block a user