Concept of a preferred set of parents

svn: r855
This commit is contained in:
Don Allingham
2002-03-24 16:44:31 +00:00
parent f19e3669ff
commit 9b437bb5ff
5 changed files with 168 additions and 147 deletions

View File

@@ -1079,12 +1079,15 @@ class Person:
def addAltFamily(self,family,mrel,frel):
"""adds a Family to the alternate family list, indicating the relationship
to the mother (mrel) and the father (frel)"""
assert(family==None)
self.AltFamilyList.append((family,mrel,frel))
def removeAltFamily(self,family):
"""removes a Family instance from the alternate family list"""
for f in self.AltFamilyList[:]:
print "+",f[0],family
if f[0] == family:
print f, family
self.AltFamilyList.remove(f)
return f
else:
@@ -1101,9 +1104,9 @@ class Person:
"""sets the main Family of the Person, the Family in which the
Person is a natural born child"""
assert(family in self.AltFamilyList)
f = self.removeFamily(family)
self.AltFamilyList = [f] + self.AltFamilyList
f = self.removeAltFamily(family)
if f:
self.AltFamilyList = [f] + self.AltFamilyList
def getMainFamily(self):
"""returns the main Family of the Person, the Family in which the