From 894aa1d810b2d69225978d4a38b3b7b9ac77042c Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Sat, 8 Jan 2005 21:42:40 +0000 Subject: [PATCH] * src/GrampsInMemDB.py (get_person_from_gramps_id, get_family_from_gramps_id,get_place_from_gramps_id, get_source_from_gramps_id,get_object_from_gramps_id): Unserialize tuple and return a proper GRAMPS object. svn: r3885 --- gramps2/ChangeLog | 5 ++++ gramps2/src/GrampsInMemDB.py | 48 +++++++++++++++++++++++------------- 2 files changed, 36 insertions(+), 17 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index ffc3771ec..0585b0f25 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -5,6 +5,11 @@ * src/plugins/FamilyGroup.py: Switch from handle to id for spouse. * src/plugins/SimpleBookTitle.py: Cleanups. + * src/GrampsInMemDB.py (get_person_from_gramps_id, + get_family_from_gramps_id,get_place_from_gramps_id, + get_source_from_gramps_id,get_object_from_gramps_id): + Unserialize tuple and return a proper GRAMPS object. + 2005-01-07 Don Allingham * src/gramps.glade: removal of more OptionMenus in favor of ComboBoxes diff --git a/gramps2/src/GrampsInMemDB.py b/gramps2/src/GrampsInMemDB.py index 77347b989..c66a70371 100644 --- a/gramps2/src/GrampsInMemDB.py +++ b/gramps2/src/GrampsInMemDB.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2004 Donald N. Allingham +# Copyright (C) 2000-2005 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -186,35 +186,49 @@ class GrampsInMemDB(GrampsDbBase): def get_person_from_gramps_id(self,val): handle = self.id_trans.get(str(val)) if handle: - return self.person_map[handle] - else: - return None + data = self.person_map[handle] + if data: + person = Person() + person.unserialize(data) + return person + return None def get_family_from_gramps_id(self,val): handle = self.fid_trans.get(str(val)) if handle: - return self.family_map[handle] - else: - return None + data = self.family_map[handle] + if data: + family = Family() + family.unserialize(data) + return family + return None def get_place_from_gramps_id(self,val): handle = self.pid_trans.get(str(val)) if handle: - return self.place_map[handle] - else: - return None + data = self.place_map[handle] + if data: + place = Place() + place.unserialize(data) + return place + return None def get_source_from_gramps_id(self,val): handle = self.sid_trans.get(str(val)) if handle: - return self.source_map[handle] - else: - return None + data = self.source_map[handle] + if data: + source = Source() + source.unserialize(data) + return source + return None def get_object_from_gramps_id(self,val): handle = self.oid_trans.get(str(val)) if handle: - return self.media_map[handle] - else: - return None - + data = self.media_map[handle] + if data: + obj = MediaObject() + obj.unserialize(data) + return obj + return None