Revision 6398
Added by Aaron Marcuse-Kubitza about 12 years ago
lib/xml_func.py | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import datetime |
4 | 4 |
import operator |
5 |
import os |
|
5 | 6 |
import re |
6 | 7 |
import sre_constants |
7 | 8 |
import warnings |
... | ... | |
232 | 233 |
xml_dom.replace(node, first) |
233 | 234 |
simplifying_funcs['_first'] = _first |
234 | 235 |
|
236 |
#### Environment access |
|
237 |
|
|
238 |
def _env(node): |
|
239 |
params = dict(xml_dom.NodeEntryIter(node)) |
|
240 |
try: name = params['name'] |
|
241 |
except KeyError, e: raise SyntaxError(e) |
|
242 |
|
|
243 |
xml_dom.replace(node, os.environ[name]) |
|
244 |
simplifying_funcs['_env'] = _env |
|
245 |
|
|
235 | 246 |
##### XML functions |
236 | 247 |
|
237 | 248 |
# Function names must start with _ to avoid collisions with real tags |
Also available in: Unified diff
xml_func.py: Simplifying functions: Added _env()