Revision 288
Added by Aaron Marcuse-Kubitza about 13 years ago
lib/xml_func.py | ||
---|---|---|
7 | 7 |
|
8 | 8 |
class SyntaxException(Exception): |
9 | 9 |
def __init__(self, cause=None): |
10 |
Exception.__init__(self, 'Invalid syntax in XML function %(func)s: '+ |
|
11 |
str(cause)) |
|
10 |
Exception.__init__(self, 'Invalid syntax in XML function: '+str(cause)) |
|
12 | 11 |
|
13 | 12 |
def map_items(func, items): |
14 | 13 |
return [(name, func(value)) for name, value in items] |
... | ... | |
77 | 76 |
name = node.tagName |
78 | 77 |
if name.startswith('_') and name in funcs: |
79 | 78 |
try: value = funcs[name](xml_dom.NodeTextEntryIter(node)) |
80 |
except SyntaxException, e: ex.repl_msg(e, func=name); raise |
|
79 |
except SyntaxException, e: |
|
80 |
ex.add_msg(e, 'function: '+str(node)) |
|
81 |
raise |
|
81 | 82 |
else: xml_dom.replace_with_text(node, value) |
82 | 83 |
else: |
83 | 84 |
for child in xml_dom.NodeElemIter(node): process(child) |
Also available in: Unified diff
xml_func.py: Print XML of XML functions with SyntaxExceptions