From 3a41651e507d25376c9d9be0afc04aeb7734226e Mon Sep 17 00:00:00 2001 From: Gerald Britton Date: Thu, 25 Jun 2009 19:15:56 +0000 Subject: [PATCH] PeopleModel: various performance tweaks svn: r12711 --- src/DisplayModels/_PeopleModel.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/DisplayModels/_PeopleModel.py b/src/DisplayModels/_PeopleModel.py index 20850ff04..0f3fc92f1 100644 --- a/src/DisplayModels/_PeopleModel.py +++ b/src/DisplayModels/_PeopleModel.py @@ -140,12 +140,13 @@ class NodeTreeMap(object): return node in self.sname_sub def find_next_node(self, node): - try: + if node in self.top_iter2path: path = self.top_iter2path[node] - if path+1 == len(self.top_path2iter): + if path+1 < len(self.top_path2iter): + return self.top_path2iter[path+1] + else: return None - return self.top_path2iter[path+1] - except: + else: (surname, val) = self.iter2path[node] return self.path2iter.get((surname, val+1))