Revision 286
Added by Aaron Marcuse-Kubitza about 13 years ago
lib/xml_func.py | ||
---|---|---|
70 | 70 |
name = node.tagName |
71 | 71 |
if name.startswith('_') and name in funcs: |
72 | 72 |
try: value = funcs[name](xml_dom.NodeTextEntryIter(node)) |
73 |
except SyntaxException, e: ex.repl_msg(e, {'func': name}); raise
|
|
73 |
except SyntaxException, e: ex.repl_msg(e, func=name); raise
|
|
74 | 74 |
else: xml_dom.replace_with_text(node, value) |
75 | 75 |
else: |
76 | 76 |
for child in xml_dom.NodeElemIter(node): process(child) |
lib/ex.py | ||
---|---|---|
2 | 2 |
|
3 | 3 |
def add_msg(e, msg): e.args = (str(e).rstrip()+'\n'+msg,) |
4 | 4 |
|
5 |
def repl_msg(e, repls): e.args = (str(e) % repls,) |
|
5 |
def repl_msg(e, **repls): e.args = (str(e) % repls,)
|
|
6 | 6 |
|
7 | 7 |
class ExceptionWithCause(Exception): |
8 | 8 |
def __init__(self, msg, cause=None): |
Also available in: Unified diff
ex.py: repl_msg(): take replacements as keyword args