### The configuration parser.
## Match a $(VAR) configuration variable reference; group 1 is the VAR.
-r_ref = RX.compile(r'\$\(([^)]+)\)')
+RX_REF = RX.compile(r'(?x) \$ \( ([^)]+) \)')
## Match a $[HOST] name resolution reference; group 1 is the HOST.
-r_resolve = RX.compile(r'\$\[([^]]+)\]')
+RX_RESOLVE = RX.compile(r'(?x) \$ \[ ([^]]+) \]')
def _fmt_path(path):
return ' -> '.join(["`%s'" % hop for hop in path])
"""
for sec in me.sections():
for key, value in me.items(sec, resolvep = False):
- for match in r_resolve.finditer(value):
+ for match in RX_RESOLVE.finditer(value):
me._resolver.prepare(match.group(1))
me._resolver.run()
or not? This is turned off by the resolve() method while it's collecting
hostnames to be resolved.
"""
- string = r_ref.sub \
+ string = RX_REF.sub \
(lambda m: me.get(sec, m.group(1), resolvep), string)
if resolvep:
- string = r_resolve.sub(lambda m: me._resolver.lookup(m.group(1)),
- string)
+ string = RX_RESOLVE.sub(lambda m: me._resolver.lookup(m.group(1)),
+ string)
return string
def has_option(me, sec, key):