* 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.


svn: r6507
This commit is contained in:
Alex Roitman 2006-05-01 23:08:09 +00:00
parent 41761b960d
commit 3b3197d702
7 changed files with 48 additions and 27 deletions

View File

@ -5,6 +5,18 @@
expand and collapse all node menu entries
2006-05-01 Alex Roitman <shura@gramps-project.org>
* 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 <shura@gramps-project.org>

View File

@ -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():
cursor = primary_tables[primary_table_name]['cursor_func']()
data = cursor.first()
if include_classes == None or primary_table_name in include_classes:
# 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']
cursor = primary_tables[primary_table_name]['cursor_func']()
data = cursor.first()
while data:
found_handle, val = data
obj = class_func()
obj.unserialize(val)
# 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']
# 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()

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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]