Revision 3920
Added by Aaron Marcuse-Kubitza over 12 years ago
xml_func.py | ||
---|---|---|
178 | 178 |
def _if(items, node): |
179 | 179 |
'''Can add `name` param to distinguish separate _if statements''' |
180 | 180 |
items = dict(items) |
181 |
try: then = items['then'] |
|
182 |
except KeyError, e: raise SyntaxError(e) |
|
181 |
then = items.get('then', None) |
|
183 | 182 |
cond = items.get('cond', None) |
184 | 183 |
else_ = items.get('else', None) |
185 | 184 |
|
Also available in: Unified diff
lib/xml_func.py: _if(): Made then param optional, so that user can just map to the else branch as a shortcut for logically inverting the condition. (Note that a _not() XML function does not exist yet, so this is also a workaround.)