From 94a899de12736e29cfece7418c4362cc7f7bc02d Mon Sep 17 00:00:00 2001 From: Celine Mercier Date: Mon, 12 Feb 2018 14:48:27 +0100 Subject: [PATCH] Cython View API: added small tools --- python/obitools3/dms/view/view.pyx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/python/obitools3/dms/view/view.pyx b/python/obitools3/dms/view/view.pyx index 36c28d0..267f127 100644 --- a/python/obitools3/dms/view/view.pyx +++ b/python/obitools3/dms/view/view.pyx @@ -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 + #############################################################