From 6496b1a81575369161d59c3bd38ff1c04d8cd540 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Mon, 20 Mar 2006 05:17:52 +0000 Subject: [PATCH] provide lower level access for cursors, but retain XML/GEDCOM compatiblity svn: r6181 --- src/GrampsDb/_GrampsBSDDB.py | 14 +++++++++++--- src/PeopleModel.py | 3 +-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/GrampsDb/_GrampsBSDDB.py b/src/GrampsDb/_GrampsBSDDB.py index ce5119c33..64c71bba3 100644 --- a/src/GrampsDb/_GrampsBSDDB.py +++ b/src/GrampsDb/_GrampsBSDDB.py @@ -84,16 +84,24 @@ def find_primary_handle(key,data): def find_referenced_handle(key,data): return str((data)[1][1]) +import cPickle as pickle + class GrampsBSDDBCursor(GrampsCursor): def __init__(self,source,txn=None): - self.cursor = source.cursor(txn) + self.cursor = source.db.cursor(txn) def first(self): - return self.cursor.first() + d = self.cursor.first() + if d: + return (d[0],pickle.loads(d[1])) + return None def next(self): - return self.cursor.next() + d = self.cursor.next() + if d: + return (d[0],pickle.loads(d[1])) + return None def close(self): self.cursor.close() diff --git a/src/PeopleModel.py b/src/PeopleModel.py index 36063529d..5f40599e1 100644 --- a/src/PeopleModel.py +++ b/src/PeopleModel.py @@ -149,12 +149,11 @@ class PeopleModel(gtk.GenericTreeModel): self.sortnames = {} - cursor = self.db.person_map.db.cursor() + cursor = self.db.get_person_cursor() node = cursor.first() while node: handle,d = node - d = pickle.loads(d) if not (handle in skip or (dfilter and not dfilter.match(handle))): name_data = d[_NAME_COL] self.sortnames[handle] = nsn(name_data)