* src/GraphLayout.py: use recursion limit to detect db loops
* src/Utils.py: use recursion limit to detect db loops svn: r5174
This commit is contained in:
parent
590136f866
commit
ecc2ab1c39
@ -1,3 +1,7 @@
|
||||
2005-09-03 Don Allingham <don@gramps-project.org>
|
||||
* src/GraphLayout.py: use recursion limit to detect db loops
|
||||
* src/Utils.py: use recursion limit to detect db loops
|
||||
|
||||
2005-09-03 Julio Sanchez <jsanchez@users.sourceforge.net>
|
||||
* src/po/es.po: Translation update
|
||||
|
||||
|
@ -46,20 +46,19 @@ class DescendLine(GraphLayout):
|
||||
|
||||
def layout(self):
|
||||
self.elist = [(0,0)]
|
||||
self.space_for(self.person_handle)
|
||||
try:
|
||||
self.space_for(self.person_handle)
|
||||
except RuntimeError,msg:
|
||||
person = self.database.get_person_from_handle(self.person_handle)
|
||||
raise Errors.DatabaseError(
|
||||
_("Database error: %s is defined as his or her own ancestor") %
|
||||
NameDisplay.displayer.display(person))
|
||||
|
||||
return (self.v,self.e[1:])
|
||||
|
||||
def space_for(self,person_handle,level=1.0,pos=1.0, current=None):
|
||||
if current == None:
|
||||
current = sets.Set()
|
||||
def space_for(self,person_handle,level=1.0,pos=1.0):
|
||||
|
||||
person = self.database.get_person_from_handle(person_handle)
|
||||
|
||||
if person_handle not in current:
|
||||
current.add(person_handle)
|
||||
else:
|
||||
raise Errors.DatabaseError(_("Database error: %s is defined as his or her own ancestor") %
|
||||
NameDisplay.displayer.display(person))
|
||||
|
||||
last = self.elist[-1]
|
||||
self.elist.append((level,pos))
|
||||
@ -73,7 +72,7 @@ class DescendLine(GraphLayout):
|
||||
for family_handle in person.get_family_handle_list():
|
||||
family = self.database.get_family_from_handle(family_handle)
|
||||
for child_handle in family.get_child_handle_list():
|
||||
self.space_for(child_handle,level+1.0,pos,current)
|
||||
self.space_for(child_handle,level+1.0,pos)
|
||||
pos = pos + max(self.depth(child_handle),1)
|
||||
if pos > self.maxy:
|
||||
self.maxy = pos
|
||||
|
@ -53,6 +53,7 @@ import const
|
||||
import GrampsMime
|
||||
import NameDisplay
|
||||
import Date
|
||||
import Errors
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -515,17 +516,7 @@ def probably_alive(person,db,current_year=None,limit=0):
|
||||
max_generation = 60
|
||||
max_age_difference = 60
|
||||
|
||||
def descendants_too_old (person, years, current=None):
|
||||
if current == None:
|
||||
current = sets.Set()
|
||||
|
||||
if person.handle not in current:
|
||||
current.add(person.handle)
|
||||
else:
|
||||
import Errors
|
||||
raise Errors.DatabaseError(_("Database error: %s is defined as his or her own ancestor") %
|
||||
NameDisplay.displayer.display(person))
|
||||
|
||||
def descendants_too_old (person, years):
|
||||
for family_handle in person.get_family_handle_list():
|
||||
family = db.get_family_from_handle(family_handle)
|
||||
family_list = family.get_child_handle_list()
|
||||
@ -550,17 +541,21 @@ def probably_alive(person,db,current_year=None,limit=0):
|
||||
if not not_too_old (dobj,current_year):
|
||||
return True
|
||||
|
||||
if descendants_too_old (child, years + min_generation,current):
|
||||
if descendants_too_old (child, years + min_generation):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
# If there are descendants that are too old for the person to have
|
||||
# been alive in the current year then they must be dead.
|
||||
if descendants_too_old (person, min_generation):
|
||||
#print person.get_primary_name().get_name(), " is dead because descendants are too old."
|
||||
return False
|
||||
|
||||
try:
|
||||
if descendants_too_old (person, min_generation):
|
||||
return False
|
||||
except RuntimeError,msg:
|
||||
raise Errors.DatabaseError(
|
||||
_("Database error: %s is defined as his or her own ancestor") %
|
||||
NameDisplay.displayer.display(person))
|
||||
|
||||
average_generation_gap = 20
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user