0002122: Detailed Ancestor Report reports people as buried who have no birth events (contributed by Gerald Britton <gerald.britton@gmail.com>)

svn: r10781
This commit is contained in:
Brian Matherly
2008-06-02 00:59:14 +00:00
parent ff0c75a7fb
commit 3a98ddd4fd
15 changed files with 354 additions and 336 deletions

View File

@@ -71,11 +71,11 @@ class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
PlaceBase.__init__(self, source)
if source:
self.description = source.description
self.type = source.type
self.__description = source.__description
self.__type = source.__type
else:
self.description = ""
self.type = EventType()
self.__description = ""
self.__type = EventType()
def serialize(self, no_text_date = False):
"""
@@ -95,9 +95,9 @@ class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
be considered persistent.
@rtype: tuple
"""
return (self.handle, self.gramps_id, self.type.serialize(),
return (self.handle, self.gramps_id, self.__type.serialize(),
DateBase.serialize(self, no_text_date),
self.description, self.place,
self.__description, self.place,
SourceBase.serialize(self),
NoteBase.serialize(self),
MediaBase.serialize(self),
@@ -114,14 +114,14 @@ class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
@type data: tuple
"""
(self.handle, self.gramps_id, the_type, date,
self.description, self.place,
self.__description, self.place,
source_list, note_list, media_list, attribute_list,
self.change, marker, self.private) = data
self.marker = MarkerType()
self.marker.unserialize(marker)
self.type = EventType()
self.type.unserialize(the_type)
self.__type = EventType()
self.__type.unserialize(the_type)
DateBase.unserialize(self, date)
MediaBase.unserialize(self, media_list)
AttributeBase.unserialize(self, attribute_list)
@@ -178,7 +178,7 @@ class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
@return: Returns the list of all textual attributes of the object.
@rtype: list
"""
return [self.description, str(self.type), self.gramps_id]
return [self.__description, str(self.__type), self.gramps_id]
def get_text_data_child_list(self):
"""
@@ -241,8 +241,8 @@ class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
"""
date = self.get_date_object()
place = self.get_place_handle()
description = self.description
the_type = self.type
description = self.__description
the_type = self.__type
return (the_type == EventType.CUSTOM and date.is_empty()
and not place and not description)
@@ -258,9 +258,9 @@ class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
if other == None:
other = Event (None)
if self.type != other.type or \
if self.__type != other.__type or \
((self.place or other.place) and (self.place != other.place)) or \
self.description != other.description \
self.__description != other.__description \
or self.private != other.private or \
(not self.get_date_object().is_equal(other.get_date_object())) or \
len(self.get_source_references()) != len(other.get_source_references()):
@@ -282,7 +282,7 @@ class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
@param the_type: Type to assign to the Event
@type the_type: tuple
"""
self.type.set(the_type)
self.__type.set(the_type)
def get_type(self):
"""
@@ -291,7 +291,8 @@ class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
@return: Type of the Event
@rtype: tuple
"""
return self.type
return self.__type
type = property(get_type, get_type, None, 'Returns or sets type of the event')
def set_description(self, description):
"""
@@ -302,7 +303,7 @@ class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
@param description: Description to assign to the Event
@type description: str
"""
self.description = description
self.__description = description
def get_description(self) :
"""
@@ -311,4 +312,5 @@ class Event(SourceBase, NoteBase, MediaBase, AttributeBase,
@return: Returns the description of the Event
@rtype: str
"""
return self.description
return self.__description
description = property(get_description, set_description, None, 'Returns or sets description of the event')

View File

@@ -49,6 +49,8 @@ class EventRef(SecondaryObject, PrivacyBase, NoteBase, AttributeBase, RefBase):
to the refereneced event.
"""
__slots__=('.__role')
def __init__(self, source=None):
"""
Create a new EventRef instance, copying from the source if present.
@@ -58,9 +60,9 @@ class EventRef(SecondaryObject, PrivacyBase, NoteBase, AttributeBase, RefBase):
AttributeBase.__init__(self, source)
RefBase.__init__(self, source)
if source:
self.role = source.role
self.__role = source.__role
else:
self.role = EventRoleType()
self.__role = EventRoleType()
def serialize(self):
"""
@@ -71,7 +73,7 @@ class EventRef(SecondaryObject, PrivacyBase, NoteBase, AttributeBase, RefBase):
NoteBase.serialize(self),
AttributeBase.serialize(self),
RefBase.serialize(self),
self.role.serialize()
self.__role.serialize()
)
def unserialize(self, data):
@@ -83,8 +85,8 @@ class EventRef(SecondaryObject, PrivacyBase, NoteBase, AttributeBase, RefBase):
NoteBase.unserialize(self, note_list)
AttributeBase.unserialize(self, attribute_list)
RefBase.unserialize(self, ref)
self.role = EventRoleType()
self.role.unserialize(role)
self.__role = EventRoleType()
self.__role.unserialize(role)
return self
def get_text_data_list(self):
@@ -94,7 +96,7 @@ class EventRef(SecondaryObject, PrivacyBase, NoteBase, AttributeBase, RefBase):
@return: Returns the list of all textual attributes of the object.
@rtype: list
"""
return [str(self.role)]
return self.__role.string
def get_text_data_child_list(self):
"""
@@ -194,10 +196,11 @@ class EventRef(SecondaryObject, PrivacyBase, NoteBase, AttributeBase, RefBase):
"""
Return the tuple corresponding to the preset role.
"""
return self.role
return self.__role
def set_role(self, role):
"""
Set the role according to the given argument.
"""
self.role.set(role)
self.__role.set(role)
role = property(get_role, set_role, None, 'Returns or sets role property')

View File

@@ -94,6 +94,7 @@ class GrampsType(object):
_BLACKLIST = None
__metaclass__ = GrampsTypeMeta
__slots__ = ('__value','__string')
@classmethod
def __class_init__(cls, namespace):
@@ -115,23 +116,23 @@ class GrampsType(object):
v = value[0]
if len(value) > 1:
s = value[1]
self.val = v
self.string = s
self.__value = v
self.__string = s
def __set_int(self, value):
self.val = value
self.string = u''
self.__value = value
self.__string = u''
def __set_instance(self, value):
self.val = value.val
self.string = value.string
self.__value = value.value
self.__string = value.string
def __set_str(self, value):
self.val = self._S2IMAP.get(value, self._CUSTOM)
if self.val == self._CUSTOM:
self.string = value
self.__value = self._S2IMAP.get(value, self._CUSTOM)
if self.__value == self._CUSTOM:
self.__string = value
else:
self.string = u''
self.__string = u''
def set(self, value):
if isinstance(value, tuple):
@@ -143,8 +144,8 @@ class GrampsType(object):
elif isinstance(value, basestring):
self.__set_str(value)
else:
self.val = self._DEFAULT
self.string = u''
self.__value = self._DEFAULT
self.__string = u''
def set_from_xml_str(self, value):
"""
@@ -152,38 +153,38 @@ class GrampsType(object):
(obtained e.g. from XML).
"""
if self._E2IMAP.has_key(value):
self.val = self._E2IMAP[value]
self.string = u''
self.__value = self._E2IMAP[value]
self.__string = u''
else:
self.val = self._CUSTOM
self.string = value
self.__value = self._CUSTOM
self.__string = value
def xml_str(self):
"""
Return the untranslated string (e.g. suitable for XML) corresponding
to the type.
"""
if self.val == self._CUSTOM:
return self.string
if self.__value == self._CUSTOM:
return self.__string
else:
return self._I2EMAP[self.val]
return self._I2EMAP[self.__value]
def serialize(self):
"""Convert the object to a serialized tuple of data. """
return (self.val, self.string)
return (self.__value, self.__string)
def unserialize(self, data):
"""Convert a serialized tuple of data to an object."""
self.val, self.string = data
self.__value, self.__string = data
def __str__(self):
if self.val == self._CUSTOM:
return self.string
if self.__value == self._CUSTOM:
return self.__string
else:
return self._I2SMAP.get(self.val, _('Unknown'))
return self._I2SMAP.get(self.__value, _('Unknown'))
def __int__(self):
return self.val
return self.__value
def get_map(self):
return self._I2SMAP
@@ -199,26 +200,28 @@ class GrampsType(object):
if (i != self._CUSTOM) and s.strip()]
def is_custom(self):
return self.val == self._CUSTOM
return self.__value == self._CUSTOM
def is_default(self):
return self.val == self._DEFAULT
return self.__value == self._DEFAULT
def get_custom(self):
return self._CUSTOM
def __cmp__(self, value):
if isinstance(value, int):
return cmp(self.val, value)
return cmp(self.__value, value)
elif isinstance(value, basestring):
if self.val == self._CUSTOM:
return cmp(self.string, value)
if self.__value == self._CUSTOM:
return cmp(self.__string, value)
else:
return cmp(self._I2SMAP.get(self.val), value)
return cmp(self._I2SMAP.get(self.__value), value)
elif isinstance(value, tuple):
return cmp((self.val, self.string), value)
return cmp((self.__value, self.__string), value)
else:
if value.val == self._CUSTOM:
return cmp(self.string, value.string)
if value.value == self._CUSTOM:
return cmp(self.__string, value.string)
else:
return cmp(self.val, value.val)
return cmp(self.__value, value.value)
value = property(__int__, __set_int, None, "Returns or sets integer value")
string = property(__str__, __set_str, None, "Returns or sets string value")