diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 7dcbd5f21..018b07650 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -5,6 +5,18 @@ expand and collapse all node menu entries 2006-05-01 Alex Roitman + * src/GrampsDb/_GrampsDbBase.py (find_backlink_handles): Correctly + loop over all primary classes looking for a given handle. + * src/RelLib/_Source.py (serialize, unserialize): properly save + and restore marker. + * src/RelLib/_MediaObject.py (serialize, unserialize): properly + save and restore marker. + * src/RelLib/_Place.py (serialize, unserialize): properly save and + restore marker. + * src/RelLib/_Repository.py (serialize, unserialize): properly + save and restore marker. + * src/RelLib/_Event.py (serialize, unserialize): properly save and + restore marker. * various: merge changes from gramps20. 2006-04-30 Alex Roitman diff --git a/gramps2/src/GrampsDb/_GrampsDbBase.py b/gramps2/src/GrampsDb/_GrampsDbBase.py index d615b3b8f..18e328797 100644 --- a/gramps2/src/GrampsDb/_GrampsDbBase.py +++ b/gramps2/src/GrampsDb/_GrampsDbBase.py @@ -1905,26 +1905,28 @@ class GrampsDbBase(GrampsDBCallback): # Now we use the functions and classes defined above to loop through - # each of the primary object tables that have been requests in the - #include_classes list. + # each of the existing primary object tables for primary_table_name in primary_tables.keys(): - - if include_classes == None or primary_table_name in include_classes: - - cursor = primary_tables[primary_table_name]['cursor_func']() - data = cursor.first() + cursor = primary_tables[primary_table_name]['cursor_func']() + data = cursor.first() - # Grap the real object class here so that the lookup does - # not happen inside the main loop. - class_func = primary_tables[primary_table_name]['class_func'] + # Grab the real object class here so that the lookup does + # not happen inside the main loop. + class_func = primary_tables[primary_table_name]['class_func'] + + while data: + found_handle, val = data + obj = class_func() + obj.unserialize(val) + + # Now we need to loop over all object types + # that have been requests in the include_classes list + for classname in primary_tables.keys(): + if (include_classes == None) \ + or (classname in include_classes): - while data: - found_handle, val = data - obj = class_func() - obj.unserialize(val) - - if obj.has_source_reference(handle): - yield (primary_table_name, found_handle) + if obj.has_handle_reference(classname,handle): + yield (primary_table_name, found_handle) data = cursor.next() diff --git a/gramps2/src/RelLib/_Event.py b/gramps2/src/RelLib/_Event.py index de3b4f6cd..95773dbc0 100644 --- a/gramps2/src/RelLib/_Event.py +++ b/gramps2/src/RelLib/_Event.py @@ -104,7 +104,7 @@ class Event(PrimaryObject,SourceBase,NoteBase,MediaBase,DateBase,PlaceBase): SourceBase.serialize(self), NoteBase.serialize(self), MediaBase.serialize(self), - self.change, self.marker, self.private) + self.change, self.marker.serialize(), self.private) def unserialize(self,data): """ @@ -118,8 +118,9 @@ class Event(PrimaryObject,SourceBase,NoteBase,MediaBase,DateBase,PlaceBase): (self.handle, self.gramps_id, the_type, date, self.description, self.place, self.cause, source_list, note, media_list, - self.change, self.marker, self.private) = data + self.change, marker, self.private) = data + self.marker.unserialize(marker) self.type.unserialize(the_type) DateBase.unserialize(self,date) MediaBase.unserialize(self,media_list) diff --git a/gramps2/src/RelLib/_MediaObject.py b/gramps2/src/RelLib/_MediaObject.py index 607413fac..f57ebd2f8 100644 --- a/gramps2/src/RelLib/_MediaObject.py +++ b/gramps2/src/RelLib/_MediaObject.py @@ -101,7 +101,9 @@ class MediaObject(PrimaryObject,SourceBase,NoteBase,DateBase,AttributeBase): SourceBase.serialize(self), NoteBase.serialize(self), self.change, - DateBase.serialize(self), self.marker, self.private) + DateBase.serialize(self), + self.marker.serialize(), + self.private) def unserialize(self,data): """ @@ -113,8 +115,9 @@ class MediaObject(PrimaryObject,SourceBase,NoteBase,DateBase,AttributeBase): """ (self.handle, self.gramps_id, self.path, self.mime, self.desc, attribute_list, source_list, note, self.change, - date, self.marker, self.private) = data + date, marker, self.private) = data + self.marker.unserialize(marker) AttributeBase.unserialize(self,attribute_list) SourceBase.unserialize(self,source_list) NoteBase.unserialize(self,note) diff --git a/gramps2/src/RelLib/_Place.py b/gramps2/src/RelLib/_Place.py index bee7b7e10..e8a94031e 100644 --- a/gramps2/src/RelLib/_Place.py +++ b/gramps2/src/RelLib/_Place.py @@ -100,7 +100,7 @@ class Place(PrimaryObject,SourceBase,NoteBase,MediaBase,UrlBase): MediaBase.serialize(self), SourceBase.serialize(self), NoteBase.serialize(self), - self.change, self.marker,self.private) + self.change, self.marker.serialize() ,self.private) def unserialize(self,data): """ @@ -113,13 +113,14 @@ class Place(PrimaryObject,SourceBase,NoteBase,MediaBase,UrlBase): """ (self.handle, self.gramps_id, self.title, self.long, self.lat, main_loc, alt_loc, urls, media_list, source_list, note, - self.change, self.marker, self.private) = data + self.change, marker, self.private) = data if main_loc == None: self.main_loc = None else: self.main_loc = Location().unserialize(main_loc) self.alt_loc = [Location().unserialize(al) for al in alt_loc] + self.marker.unserialize(marker) UrlBase.unserialize(self,urls) MediaBase.unserialize(self,media_list) SourceBase.unserialize(self,source_list) diff --git a/gramps2/src/RelLib/_Repository.py b/gramps2/src/RelLib/_Repository.py index 9be96809e..5285f4e0e 100644 --- a/gramps2/src/RelLib/_Repository.py +++ b/gramps2/src/RelLib/_Repository.py @@ -65,7 +65,7 @@ class Repository(PrimaryObject,NoteBase,AddressBase,UrlBase): NoteBase.serialize(self), AddressBase.serialize(self), UrlBase.serialize(self), - self.marker, self.private) + self.marker.serialize(), self.private) def unserialize(self,data): """ @@ -73,8 +73,9 @@ class Repository(PrimaryObject,NoteBase,AddressBase,UrlBase): back into the data in an Repository structure. """ (self.handle, self.gramps_id, the_type, self.name, note, - address_list, urls ,self.marker, self.private) = data + address_list, urls, marker, self.private) = data + self.marker.unserialize(marker) self.type.unserialize(the_type) NoteBase.unserialize(self,note) AddressBase.unserialize(self,address_list) diff --git a/gramps2/src/RelLib/_Source.py b/gramps2/src/RelLib/_Source.py index 146ac2bc1..315c6bd79 100644 --- a/gramps2/src/RelLib/_Source.py +++ b/gramps2/src/RelLib/_Source.py @@ -63,7 +63,7 @@ class Source(PrimaryObject,MediaBase,NoteBase): MediaBase.serialize(self), unicode(self.abbrev), self.change,self.datamap, [rr.serialize() for rr in self.reporef_list], - self.marker,self.private) + self.marker.serialize(),self.private) def unserialize(self,data): """ @@ -73,8 +73,9 @@ class Source(PrimaryObject,MediaBase,NoteBase): (self.handle, self.gramps_id, self.title, self.author, self.pubinfo, note, media_list, self.abbrev, self.change, self.datamap, reporef_list, - self.marker, self.private) = data + marker, self.private) = data + self.marker.unserialize(marker) NoteBase.unserialize(self,note) MediaBase.unserialize(self,media_list) self.reporef_list = [RepoRef().unserialize(rr) for rr in reporef_list]