Cleaning up Utils and refactoring common functionality

svn: r13860
This commit is contained in:
Doug Blank 2009-12-20 22:12:29 +00:00
parent 7f55894f26
commit dcb926bf87
2 changed files with 35 additions and 2 deletions

View File

@ -71,6 +71,13 @@ class EventRoleType(GrampsType):
def is_primary(self): def is_primary(self):
""" """
Returns True if EventRoleType is primary, False otherwise. Returns True if EventRoleType is PRIMARY, False otherwise.
""" """
return self.__value == self.PRIMARY return self.value == self.PRIMARY
def is_family(self):
"""
Returns True if EventRoleType is FAMILY, False otherwise.
"""
return self.value == self.FAMILY

View File

@ -190,4 +190,30 @@ class EventType(GrampsType):
def __init__(self, value=None): def __init__(self, value=None):
GrampsType.__init__(self, value) GrampsType.__init__(self, value)
def is_birth_fallback(self):
"""
Returns True if EventRoleType is a birth fallback, False
otherwise.
"""
return self.value in [self.CHRISTEN,
self.BAPTISM]
def is_death_fallback(self):
"""
Returns True if EventRoleType is a death fallback, False
otherwise.
"""
return self.value in [self.BURIAL,
self.CREMATION,
self.CAUSE_DEATH]
def is_marriage(self):
"""
Returns True if EventRoleType is MARRIAGE, False otherwise.
"""
return self.value == self.MARRIAGE
def is_divorce(self):
"""
Returns True if EventRoleType is DIVORCE, False otherwise.
"""
return self.value == self.DIVORCE