* src/RelLib.py: Use DeprecationWarning and api wrappers instead of assert to make HEAD a little more usable again until all transitition is done
svn: r4877
This commit is contained in:
parent
258a3f4f95
commit
22ea21f744
@ -2,6 +2,9 @@
|
|||||||
* src/GrampsBSDDB.py (upgrade): Disable upgrade_7 until this is
|
* src/GrampsBSDDB.py (upgrade): Disable upgrade_7 until this is
|
||||||
properly working to not accidently destroy a database from gramps20
|
properly working to not accidently destroy a database from gramps20
|
||||||
* src/plugins/TestcaseGenerator.py: Update to new tuple types
|
* src/plugins/TestcaseGenerator.py: Update to new tuple types
|
||||||
|
* src/RelLib.py: Use DeprecationWarning and api wrappers instead of
|
||||||
|
assert to make HEAD a little more usable again until all transitition
|
||||||
|
is done
|
||||||
|
|
||||||
2005-06-20 Don Allingham <don@gramps-project.org>
|
2005-06-20 Don Allingham <don@gramps-project.org>
|
||||||
* src/GenericFilter.py: optimize looping and reducing fetches
|
* src/GenericFilter.py: optimize looping and reducing fetches
|
||||||
|
@ -1562,7 +1562,21 @@ class Person(PrimaryObject,PrivateSourceNote,MediaBase,AttributeBase):
|
|||||||
@param frel: relationship between the Person and its father
|
@param frel: relationship between the Person and its father
|
||||||
@type frel: tuple
|
@type frel: tuple
|
||||||
"""
|
"""
|
||||||
|
if not type(mrel) == tuple:
|
||||||
|
if mrel in range(0,8):
|
||||||
|
warn( "add_parent_family_handle now takes a tuple", DeprecationWarning, 2)
|
||||||
|
# Wrapper for old API
|
||||||
|
# remove when transitition done.
|
||||||
|
mrel = (mrel,'')
|
||||||
|
else:
|
||||||
assert type(mrel) == tuple
|
assert type(mrel) == tuple
|
||||||
|
if not type(frel) == tuple:
|
||||||
|
if frel in range(0,8):
|
||||||
|
warn( "add_parent_family_handle now takes a tuple", DeprecationWarning, 2)
|
||||||
|
# Wrapper for old API
|
||||||
|
# remove when transitition done.
|
||||||
|
frel = (frel,'')
|
||||||
|
else:
|
||||||
assert type(frel) == tuple
|
assert type(frel) == tuple
|
||||||
self.parent_family_list.append((family_handle,mrel,frel))
|
self.parent_family_list.append((family_handle,mrel,frel))
|
||||||
|
|
||||||
@ -1977,6 +1991,14 @@ class Family(PrimaryObject,SourceNote,MediaBase,AttributeBase):
|
|||||||
between the father and mother of the relationship.
|
between the father and mother of the relationship.
|
||||||
@type relationship_type: tuple
|
@type relationship_type: tuple
|
||||||
"""
|
"""
|
||||||
|
if not type(relationship_type) == tuple:
|
||||||
|
if mrel in [Family.MARRIED,Family.UNMARRIED,Family.CIVIL_UNION,Family.UNKNOWN,Family.CUSTOM]:
|
||||||
|
warn( "set_relationship now takes a tuple", DeprecationWarning, 2)
|
||||||
|
# Wrapper for old API
|
||||||
|
# remove when transitition done.
|
||||||
|
relationship_type = (relationship_type,'')
|
||||||
|
else:
|
||||||
|
assert type(relationship_type) == tuple
|
||||||
self.type = relationship_type
|
self.type = relationship_type
|
||||||
|
|
||||||
def get_relationship(self):
|
def get_relationship(self):
|
||||||
@ -2366,6 +2388,23 @@ class Event(PrimaryObject,PrivateSourceNote,MediaBase,DateBase,PlaceBase):
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def set_name(self,name):
|
||||||
|
warn( "Use set_type instead of set_name", DeprecationWarning, 2)
|
||||||
|
# INCOMPLETE Wrapper for old API
|
||||||
|
# remove when transitition done.
|
||||||
|
if name in range(-1,45):
|
||||||
|
the_type = (name,'')
|
||||||
|
else:
|
||||||
|
the_type = (Event.CUSTOM,name)
|
||||||
|
self.set_type(the_type)
|
||||||
|
|
||||||
|
def get_name(self):
|
||||||
|
warn( "Use get_type instead of get_name", DeprecationWarning, 2)
|
||||||
|
# INCOMPLETE Wrapper for old API
|
||||||
|
# remove when transitition done.
|
||||||
|
type = self.get_type()
|
||||||
|
return type[1]
|
||||||
|
|
||||||
def set_type(self,the_type):
|
def set_type(self,the_type):
|
||||||
"""
|
"""
|
||||||
Sets the type of the Event to the passed (int,str) tuple.
|
Sets the type of the Event to the passed (int,str) tuple.
|
||||||
@ -2373,7 +2412,14 @@ class Event(PrimaryObject,PrivateSourceNote,MediaBase,DateBase,PlaceBase):
|
|||||||
@param the_type: Type to assign to the Event
|
@param the_type: Type to assign to the Event
|
||||||
@type the_type: tuple
|
@type the_type: tuple
|
||||||
"""
|
"""
|
||||||
assert type(the_type) == tuple
|
if not type(the_type) == tuple:
|
||||||
|
warn( "set_type now takes a tuple", DeprecationWarning, 2)
|
||||||
|
# Wrapper for old API
|
||||||
|
# remove when transitition done.
|
||||||
|
if the_type in range(-1,45):
|
||||||
|
the_type = (the_type,'')
|
||||||
|
else:
|
||||||
|
the_type = (Event.CUSTOM,the_type)
|
||||||
self.type = the_type
|
self.type = the_type
|
||||||
|
|
||||||
def get_type(self):
|
def get_type(self):
|
||||||
@ -3557,7 +3603,14 @@ class Attribute(PrivateSourceNote):
|
|||||||
|
|
||||||
def set_type(self,val):
|
def set_type(self,val):
|
||||||
"""sets the type (or key) of the Attribute instance"""
|
"""sets the type (or key) of the Attribute instance"""
|
||||||
assert type(val) == tuple
|
if not type(val) == tuple:
|
||||||
|
warn( "set_type now takes a tuple", DeprecationWarning, 2)
|
||||||
|
# Wrapper for old API
|
||||||
|
# remove when transitition done.
|
||||||
|
if val in range(-1,7):
|
||||||
|
val = (val,'')
|
||||||
|
else:
|
||||||
|
val = (Attribute.CUSTOM,val)
|
||||||
self.type = val
|
self.type = val
|
||||||
|
|
||||||
def get_type(self):
|
def get_type(self):
|
||||||
@ -3826,6 +3879,13 @@ class Name(PrivateSourceNote,DateBase):
|
|||||||
|
|
||||||
def set_type(self,the_type):
|
def set_type(self,the_type):
|
||||||
"""sets the type of the Name instance"""
|
"""sets the type of the Name instance"""
|
||||||
|
if not type(the_type) == tuple:
|
||||||
|
if mrel in [UNKNOWN,CUSTOM,AKA,BIRTH,MARRIED]:
|
||||||
|
warn( "set_type now takes a tuple", DeprecationWarning, 2)
|
||||||
|
# Wrapper for old API
|
||||||
|
# remove when transitition done.
|
||||||
|
the_type = (the_type,'')
|
||||||
|
else:
|
||||||
assert type(the_type) == tuple
|
assert type(the_type) == tuple
|
||||||
self.type = the_type
|
self.type = the_type
|
||||||
|
|
||||||
@ -4251,6 +4311,13 @@ class EventRef(BaseObject,PrivacyBase,NoteBase):
|
|||||||
"""
|
"""
|
||||||
Sets the role according to the given argument.
|
Sets the role according to the given argument.
|
||||||
"""
|
"""
|
||||||
|
if not type(role) == tuple:
|
||||||
|
if role in range(-1,9):
|
||||||
|
warn( "set_role now takes a tuple", DeprecationWarning, 2)
|
||||||
|
# Wrapper for old API
|
||||||
|
# remove when transitition done.
|
||||||
|
role = (role,'')
|
||||||
|
else:
|
||||||
assert type(role) == tuple
|
assert type(role) == tuple
|
||||||
self.role = role
|
self.role = role
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user