* src/plugins/WriteGedcom.py: catch filter exceptions
* src/GenericFilter.py: eliminate loop detection svn: r1758
This commit is contained in:
parent
1c808d4e5e
commit
dcca47e9fa
@ -185,8 +185,8 @@ class IsDescendantOf(Rule):
|
|||||||
return self.map.has_key(p.getId())
|
return self.map.has_key(p.getId())
|
||||||
|
|
||||||
def init_list(self,p):
|
def init_list(self,p):
|
||||||
if self.map.has_key(p.getId()) == 1:
|
# if self.map.has_key(p.getId()) == 1:
|
||||||
loop_error(self.orig,p)
|
# loop_error(self.orig,p)
|
||||||
self.map[p.getId()] = 1
|
self.map[p.getId()] = 1
|
||||||
|
|
||||||
for fam in p.getFamilyList():
|
for fam in p.getFamilyList():
|
||||||
@ -213,8 +213,8 @@ class IsDescendantFamilyOf(Rule):
|
|||||||
return self.search(p,1)
|
return self.search(p,1)
|
||||||
|
|
||||||
def search(self,p,val):
|
def search(self,p,val):
|
||||||
if self.map.has_key(p.getId()):
|
# if self.map.has_key(p.getId()):
|
||||||
loop_error(self.orig,p)
|
# loop_error(self.orig,p)
|
||||||
if p.getId() == self.list[0]:
|
if p.getId() == self.list[0]:
|
||||||
self.map[p.getId()] = 1
|
self.map[p.getId()] = 1
|
||||||
return 1
|
return 1
|
||||||
@ -262,8 +262,8 @@ class IsAncestorOf(Rule):
|
|||||||
return self.map.has_key(p.getId())
|
return self.map.has_key(p.getId())
|
||||||
|
|
||||||
def init_ancestor_list(self,p):
|
def init_ancestor_list(self,p):
|
||||||
if self.map.has_key(p.getId()) == 1:
|
# if self.map.has_key(p.getId()) == 1:
|
||||||
loop_error(self.orig,p)
|
# loop_error(self.orig,p)
|
||||||
self.map[p.getId()] = 1
|
self.map[p.getId()] = 1
|
||||||
|
|
||||||
fam = p.getMainParents()
|
fam = p.getMainParents()
|
||||||
@ -637,15 +637,20 @@ class MatchesFilter(Rule):
|
|||||||
# loop_error
|
# loop_error
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def loop_error(p1,p2):
|
# def loop_error(p1,p2):
|
||||||
p1name = p1.getPrimaryName().getName()
|
# p1name = p1.getPrimaryName().getName()
|
||||||
p2name = p2.getPrimaryName().getName()
|
# p2name = p2.getPrimaryName().getName()
|
||||||
p1id = p1.getId()
|
# p1id = p1.getId()
|
||||||
p2id = p2.getId()
|
# p2id = p2.getId()
|
||||||
raise Errors.FilterError(_("Loop detected while applying filter"),
|
# raise Errors.FilterError(_("Loop detected while applying filter"),
|
||||||
_("A relationship loop was detected between %s [%s] "
|
# _("A relationship loop was detected between %(person1_name)s "
|
||||||
"and %s [%s]. This is probably due to an error in the "
|
# "[%(person1_id)s] and %(person2_name)s [%(person2_id)s]. "
|
||||||
"database.") % (p1name,p1id,p2name,p2id))
|
# "This is probably due to an error in the "
|
||||||
|
# "database.") % {
|
||||||
|
# "person1_name" : p1name,
|
||||||
|
# "person1_id" : p1id,
|
||||||
|
# "person2_name" : p2name,
|
||||||
|
# "person2_id" : p2id})
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
@ -53,6 +53,7 @@ import Julian
|
|||||||
import Hebrew
|
import Hebrew
|
||||||
import FrenchRepublic
|
import FrenchRepublic
|
||||||
import GedcomInfo
|
import GedcomInfo
|
||||||
|
import Errors
|
||||||
import ansel_utf8
|
import ansel_utf8
|
||||||
|
|
||||||
from intl import gettext as _
|
from intl import gettext as _
|
||||||
@ -455,8 +456,13 @@ class GedcomWriter:
|
|||||||
for p in self.db.getPersonKeys():
|
for p in self.db.getPersonKeys():
|
||||||
self.plist[p] = 1
|
self.plist[p] = 1
|
||||||
else:
|
else:
|
||||||
for p in cfilter.apply(self.db, self.db.getPersonMap().values()):
|
try:
|
||||||
self.plist[p.getId()] = 1
|
for p in cfilter.apply(self.db, self.db.getPersonMap().values()):
|
||||||
|
self.plist[p.getId()] = 1
|
||||||
|
except Errors.FilterError, msg:
|
||||||
|
(m1,m2) = msg.messages()
|
||||||
|
ErrorDialog(m1,m2)
|
||||||
|
return
|
||||||
|
|
||||||
self.flist = {}
|
self.flist = {}
|
||||||
self.slist = {}
|
self.slist = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user