Revision 1047
Added by Aaron Marcuse-Kubitza almost 13 years ago
lib/xml_func.py | ||
---|---|---|
7 | 7 |
import exc |
8 | 8 |
import maps |
9 | 9 |
import term |
10 |
import util |
|
10 | 11 |
import xml_dom |
11 | 12 |
|
12 | 13 |
##### Exceptions |
... | ... | |
75 | 76 |
return label+': '+value |
76 | 77 |
funcs['_label'] = _label |
77 | 78 |
|
79 |
def _nullIf(items): |
|
80 |
items = dict(conv_items(str, items)) |
|
81 |
try: |
|
82 |
null = items['null'] |
|
83 |
value = items['value'] |
|
84 |
except KeyError, e: raise SyntaxException(e) |
|
85 |
else: |
|
86 |
type_str = items.get('type', None) |
|
87 |
type_ = str |
|
88 |
if type_str == 'float': type_ = float |
|
89 |
return util.none_if(value, type_(null)) |
|
90 |
funcs['_nullIf'] = _nullIf |
|
91 |
|
|
78 | 92 |
def _range(items): |
79 | 93 |
items = dict(conv_items(float, items)) |
80 | 94 |
from_ = items.get('from', None) |
Also available in: Unified diff
xml_func.py: Added _nullIf