Cython View API: added small tools

This commit is contained in:
Celine Mercier
2018-02-12 14:48:27 +01:00
parent b48330a5c9
commit 94a899de12

View File

@ -389,6 +389,12 @@ cdef class View(OBIWrapper) :
raise OBIDeactivatedInstanceError()
return self.pointer().infos.line_count
# line_count property getter
@property
def read_only(self):
if not self.active() :
raise OBIDeactivatedInstanceError()
return self.pointer().read_only
# name property getter
@property
@ -435,6 +441,8 @@ cdef class Line :
cdef bytes column_name_b
column_name_b = tobytes(column_name)
# TODO use functions in utils
if column_name_b not in self._view :
if value == None :
@ -458,7 +466,8 @@ cdef class Line :
elif (len(value) > 1) :
value_obitype = OBI_STR
else :
raise RollbackException("Could not guess the type of a value to create a new column", self)
raise CantGuessTypeException()
#raise RollbackException("Could not guess the type of a value to create a new column", self._view)
Column.new_column(self._view, column_name_b, value_obitype)
@ -636,6 +645,9 @@ class RollbackException(Exception):
OBIWrapper.close(view)
class CantGuessTypeException(Exception):
pass
#############################################################