Cython View API: added small tools
This commit is contained in:
@ -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
|
||||
@ -436,6 +442,8 @@ cdef class Line :
|
||||
|
||||
column_name_b = tobytes(column_name)
|
||||
|
||||
# TODO use functions in utils
|
||||
|
||||
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)
|
||||
@ -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
|
||||
|
||||
#############################################################
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user