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>
|
||||
* src/GrampsDb/_GrampsDbBase.py (GrampsDbBase.get_name_group_mapping): convert
|
||||
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 _RegExpIdOf import RegExpIdOf
|
||||
|
||||
# This is the name->class storage for private rule classes
|
||||
private = {}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# This is used by Custom Filter Editor tool
|
||||
@ -156,4 +159,5 @@ editor_rule_list = [
|
||||
]
|
||||
|
||||
def register(rule):
|
||||
private[rule.__name__] = rule
|
||||
editor_rule_list.append(rule)
|
||||
|
@ -91,15 +91,21 @@ class FilterParser(handler.ContentHandler):
|
||||
except (ImportError, NameError, AttributeError ):
|
||||
# Now try to use name from Rules.Namespace
|
||||
mc_match = save_name.split('.')
|
||||
last_name = mc_match[-1]
|
||||
try:
|
||||
exec 'self.r = Rules.%s.%s' % (
|
||||
self.namespace,mc_match[-1])
|
||||
except (ImportError, NameError ):
|
||||
print "ERROR: Filter rule '%s' in "\
|
||||
"filter '%s' not found!"\
|
||||
% (save_name,self.f.get_name())
|
||||
self.r = None
|
||||
return
|
||||
self.namespace,last_name)
|
||||
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 "\
|
||||
"filter '%s' not found!"\
|
||||
% (save_name,self.f.get_name())
|
||||
self.r = None
|
||||
return
|
||||
self.a = []
|
||||
elif tag == "arg":
|
||||
self.a.append(attrs['value'])
|
||||
|
Loading…
Reference in New Issue
Block a user