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 @type source: AddressBase
""" """
if source: if source:
self.address_list = [ Address(address) \ self.address_list = [Address(addr) for addr in source.address_list]
for address in source.address_list ]
else: else:
self.address_list = [] self.address_list = []

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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