4758: Copy constructor of gen.lib objects uses shallow copy instead of deep copy

svn: r16825
This commit is contained in:
Michiel Nauta 2011-03-15 21:52:08 +00:00
parent efbff4178a
commit 3e76c9d3b5
11 changed files with 12 additions and 10 deletions

View File

@ -67,7 +67,7 @@ class Attribute(SecondaryObject, PrivacyBase, SourceBase, NoteBase):
NoteBase.__init__(self, source)
if source:
self.type = source.type
self.type = AttributeType(source.type)
self.value = source.value
else:
self.type = AttributeType()

View File

@ -57,8 +57,8 @@ class ChildRef(SecondaryObject, PrivacyBase, SourceBase, NoteBase, RefBase):
NoteBase.__init__(self, source)
RefBase.__init__(self, source)
if source:
self.frel = source.frel
self.mrel = source.mrel
self.frel = ChildRefType(source.frel)
self.mrel = ChildRefType(source.mrel)
else:
self.frel = ChildRefType()
self.mrel = ChildRefType()

View File

@ -76,7 +76,7 @@ class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
if source:
self.__description = source.__description
self.__type = source.__type
self.__type = EventType(source.__type)
else:
self.__description = ""
self.__type = EventType()

View File

@ -60,7 +60,7 @@ class EventRef(SecondaryObject, PrivacyBase, NoteBase, AttributeBase, RefBase):
AttributeBase.__init__(self, source)
RefBase.__init__(self, source)
if source:
self.__role = source.__role
self.__role = EventRoleType(source.__role)
else:
self.__role = EventRoleType()

View File

@ -47,6 +47,7 @@ class GenderStats(object):
if stats is None:
self.stats = {}
else:
# Current use of GenderStats is such that a shallow copy suffices.
self.stats = stats
def save_stats(self):

View File

@ -90,7 +90,7 @@ class Name(SecondaryObject, PrivacyBase, SurnameBase, SourceBase, NoteBase,
self.first_name = source.first_name
self.suffix = source.suffix
self.title = source.title
self.type = source.type
self.type = NameType(source.type)
self.group_as = source.group_as
self.sort_as = source.sort_as
self.display_as = source.display_as

View File

@ -53,7 +53,7 @@ class RepoRef(SecondaryObject, PrivacyBase, NoteBase, RefBase):
RefBase.__init__(self, source)
if source:
self.call_number = source.call_number
self.media_type = source.media_type
self.media_type = SourceMediaType(source.media_type)
else:
self.call_number = ""
self.media_type = SourceMediaType()

View File

@ -61,6 +61,7 @@ class StyledTextTag(object):
if ranges is None:
self.ranges = []
else:
# Current use of StyledTextTag is such that a shallow copy suffices.
self.ranges = ranges
def serialize(self):

View File

@ -53,7 +53,7 @@ class Surname(SecondaryObject):
self.surname = source.surname
self.prefix = source.prefix
self.primary = source.primary
self.origintype = source.origintype
self.origintype = NameOriginType(source.origintype)
self.connector = source.connector
else:
self.surname = ""

View File

@ -44,7 +44,7 @@ class TagBase(object):
:type source: TagBase
"""
if source:
self.tag_list = source.tag_list
self.tag_list = list(source.tag_list)
else:
self.tag_list = []

View File

@ -60,7 +60,7 @@ class Url(SecondaryObject, PrivacyBase):
if source:
self.path = source.path
self.desc = source.desc
self.type = source.type
self.type = UrlType(source.type)
else:
self.path = ""
self.desc = ""