2006-08-26 Alex Roitman <shura@gramps-project.org>
* src/Filters/Rules/Person/__init__.py (register): Add dictionary for private rules. * src/Filters/_FilterParser.py (startElement): Support parsing for private rules. svn: r7272
This commit is contained in:
parent
13bca83d4c
commit
096613dfd1
@ -1,3 +1,9 @@
|
|||||||
|
2006-08-26 Alex Roitman <shura@gramps-project.org>
|
||||||
|
* src/Filters/Rules/Person/__init__.py (register): Add dictionary
|
||||||
|
for private rules.
|
||||||
|
* src/Filters/_FilterParser.py (startElement): Support parsing for
|
||||||
|
private rules.
|
||||||
|
|
||||||
2006-08-26 Don Allingham <don@gramps-project.org>
|
2006-08-26 Don Allingham <don@gramps-project.org>
|
||||||
* src/GrampsDb/_GrampsDbBase.py (GrampsDbBase.get_name_group_mapping): convert
|
* src/GrampsDb/_GrampsDbBase.py (GrampsDbBase.get_name_group_mapping): convert
|
||||||
group as name used as a key back to unicode (bug #389)
|
group as name used as a key back to unicode (bug #389)
|
||||||
|
@ -93,6 +93,9 @@ from _RegExpName import RegExpName
|
|||||||
from _MatchIdOf import MatchIdOf
|
from _MatchIdOf import MatchIdOf
|
||||||
from _RegExpIdOf import RegExpIdOf
|
from _RegExpIdOf import RegExpIdOf
|
||||||
|
|
||||||
|
# This is the name->class storage for private rule classes
|
||||||
|
private = {}
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# This is used by Custom Filter Editor tool
|
# This is used by Custom Filter Editor tool
|
||||||
@ -156,4 +159,5 @@ editor_rule_list = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
def register(rule):
|
def register(rule):
|
||||||
|
private[rule.__name__] = rule
|
||||||
editor_rule_list.append(rule)
|
editor_rule_list.append(rule)
|
||||||
|
@ -91,10 +91,16 @@ class FilterParser(handler.ContentHandler):
|
|||||||
except (ImportError, NameError, AttributeError ):
|
except (ImportError, NameError, AttributeError ):
|
||||||
# Now try to use name from Rules.Namespace
|
# Now try to use name from Rules.Namespace
|
||||||
mc_match = save_name.split('.')
|
mc_match = save_name.split('.')
|
||||||
|
last_name = mc_match[-1]
|
||||||
try:
|
try:
|
||||||
exec 'self.r = Rules.%s.%s' % (
|
exec 'self.r = Rules.%s.%s' % (
|
||||||
self.namespace,mc_match[-1])
|
self.namespace,last_name)
|
||||||
except (ImportError, NameError ):
|
except (ImportError, NameError, AttributeError ):
|
||||||
|
# Now try the private rule
|
||||||
|
try:
|
||||||
|
exec "self.r = Rules.%s.private['%s']" % (
|
||||||
|
self.namespace,last_name)
|
||||||
|
except KeyError:
|
||||||
print "ERROR: Filter rule '%s' in "\
|
print "ERROR: Filter rule '%s' in "\
|
||||||
"filter '%s' not found!"\
|
"filter '%s' not found!"\
|
||||||
% (save_name,self.f.get_name())
|
% (save_name,self.f.get_name())
|
||||||
|
Loading…
Reference in New Issue
Block a user