It is now impossible to create a view with a name identical to one of an

existing written view
This commit is contained in:
Celine Mercier
2016-03-01 13:36:54 +01:00
parent fc5a12bad7
commit a08def47e6
4 changed files with 52 additions and 1 deletions

View File

@ -56,6 +56,7 @@ from .capi.obiview cimport Obiview_p, \
obi_new_view_nuc_seqs_cloned_from_name, \
obi_open_view, \
obi_read_views, \
obi_unmap_read_views, \
obi_view_delete_column, \
obi_view_add_column, \
obi_view_get_column, \
@ -682,7 +683,7 @@ cdef class OBIDMS :
return all_views[view_name]
cpdef dict read_views(self) : # TODO function that gets 1 view with name, function that prints the dic and function that prints 1 view. Add column type in col ref
cpdef dict read_views(self) : # TODO function that prints the dic nicely and function that prints 1 view. Add column type in col ref
cdef Obiviews_infos_all_p all_views_p
cdef Obiview_infos_p view_p
@ -696,6 +697,8 @@ cdef class OBIDMS :
views = {}
all_views_p = obi_read_views(self.pointer)
if all_views_p == NULL :
raise Exception("No views to read")
nb_views = <int> (all_views_p.header).view_count
for i in range(nb_views) :
view_p = (<Obiview_infos_p> (all_views_p.view_infos)) + i
@ -721,6 +724,8 @@ cdef class OBIDMS :
views[view_name]["column_references"][column_name] = {}
views[view_name]["column_references"][column_name]["version"] = column_refs[j].version
obi_unmap_read_views(all_views_p);
return views