From 77cf5446369139d98b2676c2fac61d927a254742 Mon Sep 17 00:00:00 2001 From: Michiel Nauta Date: Wed, 27 Apr 2011 17:45:37 +0000 Subject: [PATCH] Add some debug statements to find cause of bug 4481/4834 svn: r17295 --- src/gui/views/treemodels/treebasemodel.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/gui/views/treemodels/treebasemodel.py b/src/gui/views/treemodels/treebasemodel.py index 322e16035..d2039dd2a 100644 --- a/src/gui/views/treemodels/treebasemodel.py +++ b/src/gui/views/treemodels/treebasemodel.py @@ -833,13 +833,21 @@ class TreeBaseModel(gtk.GenericTreeModel): """ if not self.tree or not self.tree[None].children: return None + _LOG.debug('path argument of on_get_iter method %s' % str(path)) node = self.tree[None] pathlist = list(path) - for index in pathlist: - if self.__reverse: - node = self.nodemap.node(node.children[-index - 1][1]) - else: - node = self.nodemap.node(node.children[index][1]) + try: + for index in pathlist: + if self.__reverse: + node = self.nodemap.node(node.children[-index - 1][1]) + else: + node = self.nodemap.node(node.children[index][1]) + except IndexError: + # From the gtk.TreeModel.get_iter documentation: + # This method raises a ValueError exception if path is not a valid + # tree path. + raise ValueError("list index, %s, out of range; max is %d; reverse is %s" % \ + (index, len(node.children), self.__reverse)) return node def on_get_path(self, node):