Revision 1427
Added by Aaron Marcuse-Kubitza almost 13 years ago
lib/xml_func.py | ||
---|---|---|
144 | 144 |
repl = r'(?<![^\W_])'+repl+r'(?![^\W_])' # match whole word |
145 | 145 |
value = re.sub(repl, with_, value) |
146 | 146 |
except sre_constants.error, e: raise SyntaxException(e) |
147 |
return value
|
|
147 |
return util.none_if(value, u'') # empty strings always mean None
|
|
148 | 148 |
funcs['_replace'] = _replace |
149 | 149 |
|
150 | 150 |
def _units(items): |
... | ... | |
168 | 168 |
default = (str_, None) |
169 | 169 |
start, sep, end = str_.partition(range_sep) |
170 | 170 |
if sep == '': return default # not a range |
171 |
if start == '' and range_sep == '-': return default # negative number |
|
171 | 172 |
return tuple(d.strip() for d in (start, end)) |
172 | 173 |
|
173 | 174 |
def _rangeStart(items): |
Also available in: Unified diff
xml_func.py: parse_range(): Handle negative numbers by treating them as not a range