Removing InstanceType calls from gen.lib modules. Required by the

GrampsTypeMeta changes.


svn: r10402
This commit is contained in:
Zsolt Foldvari 2008-03-26 18:45:58 +00:00
parent 695168661e
commit 6bb0c17384
7 changed files with 17 additions and 53 deletions

View File

@ -52,8 +52,7 @@ class AddressBase:
@type source: AddressBase
"""
if source:
self.address_list = [ Address(address) \
for address in source.address_list ]
self.address_list = [Address(addr) for addr in source.address_list]
else:
self.address_list = []

View File

@ -139,16 +139,10 @@ class Family(SourceBase, NoteBase, MediaBase, AttributeBase, LdsOrdBase,
self.marker.unserialize(marker)
self.type = FamilyRelType()
self.type.unserialize(the_type)
self.event_ref_list = []
for er in event_ref_list:
eventref = EventRef()
eventref.unserialize(er)
self.event_ref_list.append(eventref)
self.child_ref_list = []
for cr in child_ref_list:
childref = ChildRef()
childref.unserialize(cr)
self.child_ref_list.append(childref)
self.event_ref_list = [EventRef().unserialize(er)
for er in event_ref_list]
self.child_ref_list = [ChildRef().unserialize(cr)
for cr in child_ref_list]
MediaBase.unserialize(self, media_list)
AttributeBase.unserialize(self, attribute_list)
SourceBase.unserialize(self, source_list)

View File

@ -24,13 +24,6 @@
Note class for GRAMPS.
"""
#-------------------------------------------------------------------------
#
# standard python modules
#
#-------------------------------------------------------------------------
from types import InstanceType
#-------------------------------------------------------------------------
#
# GRAMPS modules
@ -81,9 +74,9 @@ class Note(BasicPrimaryObject):
(self.handle, self.gramps_id, self.text, self.format,
the_type, self.change, the_marker, self.private) = data
self.marker = InstanceType(MarkerType)
self.marker = MarkerType()
self.marker.unserialize(the_marker)
self.type = InstanceType(NoteType)
self.type = NoteType()
self.type.unserialize(the_type)
def get_text_data_list(self):

View File

@ -187,21 +187,12 @@ class Person(SourceBase, NoteBase, AttributeBase, MediaBase,
self.marker.unserialize(marker)
self.primary_name = Name()
self.primary_name.unserialize(primary_name)
self.alternate_names = []
for name in alternate_names:
n = Name()
n.unserialize(name)
self.alternate_names.append(n)
self.event_ref_list = []
for er in event_ref_list:
eventref = EventRef()
eventref.unserialize(er)
self.event_ref_list.append(eventref)
self.person_ref_list = []
for pr in person_ref_list:
personref = PersonRef()
personref.unserialize(pr)
self.person_ref_list.append(personref)
self.alternate_names = [Name().unserialize(name)
for name in alternate_names]
self.event_ref_list = [EventRef().unserialize(er)
for er in event_ref_list]
self.person_ref_list = [PersonRef().unserialize(pr)
for pr in person_ref_list]
MediaBase.unserialize(self, media_list)
LdsOrdBase.unserialize(self, lds_ord_list)
AddressBase.unserialize(self, address_list)

View File

@ -124,13 +124,8 @@ class Place(SourceBase, NoteBase, MediaBase, UrlBase, PrimaryObject):
if main_loc is None:
self.main_loc = None
else:
self.main_loc = Location()
self.main_loc.unserialize(main_loc)
self.alt_loc = []
for al in alt_loc:
location = Location()
location.unserialize(al)
self.alt_loc.append(location)
self.main_loc = Location().unserialize(main_loc)
self.alt_loc = [Location().unserialize(al) for al in alt_loc]
self.marker = MarkerType()
self.marker.unserialize(marker)
UrlBase.unserialize(self, urls)

View File

@ -82,11 +82,7 @@ class Source(MediaBase, NoteBase, PrimaryObject):
self.marker.unserialize(marker)
NoteBase.unserialize(self, note_list)
MediaBase.unserialize(self, media_list)
self.reporef_list = []
for rr in reporef_list:
reporef = RepoRef()
reporef.unserialize(rr)
self.reporef_list.append(reporef)
self.reporef_list = [RepoRef().unserialize(rr) for rr in reporef_list]
def _has_handle_reference(self, classname, handle):
"""

View File

@ -63,11 +63,7 @@ class SourceBase:
"""
Convert a serialized tuple of data to an object.
"""
self.source_list = []
for item in data:
sourceref = SourceRef()
sourceref.unserialize(item)
self.source_list.append(sourceref)
self.source_list = [SourceRef().unserialize(item) for item in data]
def add_source_reference(self, src_ref) :
"""