diff --git a/gramps/gen/filters/rules/_hasnotebase.py b/gramps/gen/filters/rules/_hasnotebase.py index ea688715a..91acdf7f0 100755 --- a/gramps/gen/filters/rules/_hasnotebase.py +++ b/gramps/gen/filters/rules/_hasnotebase.py @@ -50,13 +50,13 @@ class HasNoteBase(Rule): description = "Matches objects that have a certain number of notes" category = _('General filters') - def __init__(self, arg): + def __init__(self, arg, use_regex=False): # Upgrade from pre 3.1 HasNote filter, use defaults that correspond # Previous filter had 0 arguments if len(arg) == 0: - Rule.__init__(self, ["0", 'greater than']) + Rule.__init__(self, ["0", 'greater than'], use_regex) else: - Rule.__init__(self, arg) + Rule.__init__(self, arg, use_regex) def prepare(self, db): # things we want to do just once, not for every handle diff --git a/gramps/gen/filters/rules/_hasnoteregexbase.py b/gramps/gen/filters/rules/_hasnoteregexbase.py index a32b06cd8..975f343ab 100644 --- a/gramps/gen/filters/rules/_hasnoteregexbase.py +++ b/gramps/gen/filters/rules/_hasnoteregexbase.py @@ -48,8 +48,8 @@ class HasNoteRegexBase(Rule): "matching a regular expression" category = _('General filters') - def __init__(self, list): - Rule.__init__(self, list) + def __init__(self, list, use_regex=False): + Rule.__init__(self, list, use_regex) try: self.match = re.compile(list[0],re.I|re.U|re.L) diff --git a/gramps/gen/filters/rules/_hastextmatchingregexpof.py b/gramps/gen/filters/rules/_hastextmatchingregexpof.py index 64cc8b970..e5eb909a8 100644 --- a/gramps/gen/filters/rules/_hastextmatchingregexpof.py +++ b/gramps/gen/filters/rules/_hastextmatchingregexpof.py @@ -34,8 +34,8 @@ class HasTextMatchingRegexpOf(HasTextMatchingSubstringOf): """ Wrap HasTextMatchingSubstringOf to enable the regex_match parameter. """ - def __init__(self, list): - HasTextMatchingSubstringOf.__init__(self, list) + def __init__(self, list, use_regex=False): + HasTextMatchingSubstringOf.__init__(self, list, use_regex) # FIXME: This needs to be written for an arbitrary object # if possible diff --git a/gramps/gen/filters/rules/_regexpidbase.py b/gramps/gen/filters/rules/_regexpidbase.py index cb486e01a..a3fdf32e0 100644 --- a/gramps/gen/filters/rules/_regexpidbase.py +++ b/gramps/gen/filters/rules/_regexpidbase.py @@ -52,8 +52,8 @@ class RegExpIdBase(Rule): "the regular expression" category = _('General filters') - def __init__(self, list): - Rule.__init__(self, list) + def __init__(self, list, use_regex=False): + Rule.__init__(self, list, use_regex) try: self.match = re.compile(list[0], re.I|re.U|re.L) diff --git a/gramps/gen/filters/rules/event/_hasdata.py b/gramps/gen/filters/rules/event/_hasdata.py index c74b2ba1e..44e601cbd 100644 --- a/gramps/gen/filters/rules/event/_hasdata.py +++ b/gramps/gen/filters/rules/event/_hasdata.py @@ -51,8 +51,8 @@ class HasData(Rule): description = _("Matches events with data of a particular value") category = _('General filters') - def __init__(self, list): - Rule.__init__(self, list) + def __init__(self, list, use_regex=False): + Rule.__init__(self, list, use_regex) self.event_type = self.list[0] self.date = self.list[1] diff --git a/gramps/gen/filters/rules/note/_matchesregexpof.py b/gramps/gen/filters/rules/note/_matchesregexpof.py index 340597143..c07ec01f6 100644 --- a/gramps/gen/filters/rules/note/_matchesregexpof.py +++ b/gramps/gen/filters/rules/note/_matchesregexpof.py @@ -48,8 +48,8 @@ class MatchesRegexpOf(Rule): "which matches a regular expression") category = _('General filters') - def __init__(self, list): - Rule.__init__(self, list) + def __init__(self, list, use_regex=False): + Rule.__init__(self, list, use_regex) try: self.match = re.compile(list[0], re.I|re.U|re.L) diff --git a/gramps/gen/filters/rules/person/_hasbirth.py b/gramps/gen/filters/rules/person/_hasbirth.py index 86eb69483..5f0b6e163 100644 --- a/gramps/gen/filters/rules/person/_hasbirth.py +++ b/gramps/gen/filters/rules/person/_hasbirth.py @@ -51,8 +51,8 @@ class HasBirth(Rule): description = _("Matches people with birth data of a particular value") category = _('Event filters') - def __init__(self,list): - Rule.__init__(self,list) + def __init__(self, list, use_regex=False): + Rule.__init__(self, list, use_regex) if self.list[0]: self.date = parser.parse(self.list[0]) else: diff --git a/gramps/gen/filters/rules/person/_hascommonancestorwithfiltermatch.py b/gramps/gen/filters/rules/person/_hascommonancestorwithfiltermatch.py index 0b0b1ca89..c1ba028e6 100644 --- a/gramps/gen/filters/rules/person/_hascommonancestorwithfiltermatch.py +++ b/gramps/gen/filters/rules/person/_hascommonancestorwithfiltermatch.py @@ -52,8 +52,8 @@ class HasCommonAncestorWithFilterMatch(HasCommonAncestorWith): "with anybody matched by a filter") category = _("Ancestral filters") - def __init__(self, list): - HasCommonAncestorWith.__init__(self, list) + def __init__(self, list, use_regex=False): + HasCommonAncestorWith.__init__(self, list, use_regex) self.ancestor_cache = {} def prepare(self, db): diff --git a/gramps/gen/filters/rules/person/_hasdeath.py b/gramps/gen/filters/rules/person/_hasdeath.py index fcce0efdc..96e84ca7d 100644 --- a/gramps/gen/filters/rules/person/_hasdeath.py +++ b/gramps/gen/filters/rules/person/_hasdeath.py @@ -51,8 +51,8 @@ class HasDeath(Rule): description = _("Matches people with death data of a particular value") category = _('Event filters') - def __init__(self,list): - Rule.__init__(self,list) + def __init__(self, list, use_regex=False): + Rule.__init__(self, list, use_regex) if self.list[0]: self.date = parser.parse(self.list[0]) else: diff --git a/gramps/gen/filters/rules/person/_hasgallery.py b/gramps/gen/filters/rules/person/_hasgallery.py index 598229b08..2e5c463a8 100644 --- a/gramps/gen/filters/rules/person/_hasgallery.py +++ b/gramps/gen/filters/rules/person/_hasgallery.py @@ -44,10 +44,10 @@ class HavePhotos(HasGalleryBase): name = _('People with media') description = _("Matches people with a certain number of items in the gallery") - def __init__(self, arg): + def __init__(self, arg, use_regex=False): # Upgrade from pre 3.1 HasPhotos filter, use defaults that correspond # Previous filter had 0 arguments if len(arg) == 0: - HasGalleryBase.__init__(self, ["0", 'greater than']) + HasGalleryBase.__init__(self, ["0", 'greater than'], use_regex) else: - HasGalleryBase.__init__(self, arg) + HasGalleryBase.__init__(self, arg, use_regex) diff --git a/gramps/gen/filters/rules/person/_hastextmatchingregexpof.py b/gramps/gen/filters/rules/person/_hastextmatchingregexpof.py index 18f177447..592e394cf 100644 --- a/gramps/gen/filters/rules/person/_hastextmatchingregexpof.py +++ b/gramps/gen/filters/rules/person/_hastextmatchingregexpof.py @@ -41,8 +41,8 @@ class HasTextMatchingRegexpOf(HasTextMatchingSubstringOf): parameter. """ - def __init__(self,list): - HasTextMatchingSubstringOf.__init__(self,list) + def __init__(self, list, use_regex=False): + HasTextMatchingSubstringOf.__init__(self, list, use_regex) def prepare(self,db): self.db = db diff --git a/gramps/gen/filters/rules/person/_isancestoroffiltermatch.py b/gramps/gen/filters/rules/person/_isancestoroffiltermatch.py index d878128d7..b0a4a1227 100644 --- a/gramps/gen/filters/rules/person/_isancestoroffiltermatch.py +++ b/gramps/gen/filters/rules/person/_isancestoroffiltermatch.py @@ -51,10 +51,6 @@ class IsAncestorOfFilterMatch(IsAncestorOf): description = _("Matches people that are ancestors " "of anybody matched by a filter") - - def __init__(self,list): - IsAncestorOf.__init__(self,list) - def prepare(self,db): self.db = db self.map = set() diff --git a/gramps/gen/filters/rules/person/_isdescendantoffiltermatch.py b/gramps/gen/filters/rules/person/_isdescendantoffiltermatch.py index 0ebae5862..e5c943de8 100644 --- a/gramps/gen/filters/rules/person/_isdescendantoffiltermatch.py +++ b/gramps/gen/filters/rules/person/_isdescendantoffiltermatch.py @@ -51,10 +51,6 @@ class IsDescendantOfFilterMatch(IsDescendantOf): description = _("Matches people that are descendants " "of anybody matched by a filter") - -# def __init__(self,list): -# IsDescendantOf.__init__(self,list) - def prepare(self,db): self.db = db self.map = set() diff --git a/gramps/gen/filters/rules/person/_regexpname.py b/gramps/gen/filters/rules/person/_regexpname.py index 535f2eafe..2d19c9eba 100644 --- a/gramps/gen/filters/rules/person/_regexpname.py +++ b/gramps/gen/filters/rules/person/_regexpname.py @@ -50,8 +50,8 @@ class RegExpName(Rule): description = _("Matches people's names with a specified regular expression") category = _('General filters') - def __init__(self, list): - Rule.__init__(self, list) + def __init__(self, list, use_regex=False): + Rule.__init__(self, list, use_regex) try: self.match = re.compile(list[0],re.I|re.U|re.L)