Raise error if duplicate handle added to model

svn: r15680
This commit is contained in:
Nick Hall 2010-08-02 14:12:12 +00:00
parent e0df78182c
commit 27ab4c5484
2 changed files with 5 additions and 2 deletions

View File

@ -303,6 +303,9 @@ class FlatNodeMap(object):
:Returns: path of the row inserted in the treeview
:Returns type: integer or None
"""
if srtkey_hndl[1] in self._hndl2index:
raise ValueError, 'Attempt to add row twice to the model (%s)' % \
srtkey_hndl[1]
if not self._identical:
bisect.insort_left(self._fullhndl, srtkey_hndl)
if allkeyonly:

View File

@ -590,8 +590,8 @@ class TreeBaseModel(gtk.GenericTreeModel):
Otherwise, a node should never be added twice!
"""
if not self.group_can_have_handle:
raise ValueError, 'attempt to add twice a node to the model %s' % \
str(parent) + ' ' + str(child) + ' ' + sortkey
raise ValueError, 'Attempt to add node twice to the model (%s:%s)' \
% (str(parent), str(child))
if handle:
node.set_handle(handle)
if not self._in_build: