|
@@ -124,9 +124,17 @@ class PersonCollection:
|
|
|
|
|
|
>>> bob = Person("bob")
|
|
|
>>> bob.birth_date = datetime.date(2010, 2, 3)
|
|
|
+ >>> bob.mother = Person("bob-mum")
|
|
|
+ >>> bob.father = Person("bob-dad")
|
|
|
>>> c.add_person(bob)
|
|
|
Person(bob, *2010-02-03)
|
|
|
+ >>> list(c)
|
|
|
+ [Person(alice), Person(bob, *2010-02-03), Person(bob-mum), Person(bob-dad)]
|
|
|
"""
|
|
|
+ if person.mother is not None:
|
|
|
+ self.add_person(person.mother)
|
|
|
+ if person.father is not None:
|
|
|
+ self.add_person(person.father)
|
|
|
if person.identifier not in self._persons:
|
|
|
self._persons[person.identifier] = person
|
|
|
return person
|