comparison configmix/config.py @ 524:09b8e28b7a44

Implement Configuration.getvar_s() by using Configuration.getvarl() instead of Configuration.getvar(). This allows for proper caching of variable interpolation in the future.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 20 Dec 2021 02:00:03 +0100
parents 085962f6c81f
children be6ef72c55d5
comparison
equal deleted inserted replaced
523:085962f6c81f 524:09b8e28b7a44
609 and filters are applied. 609 and filters are applied.
610 610
611 For more details see chapter :ref:`variable-interpolation`. 611 For more details see chapter :ref:`variable-interpolation`.
612 612
613 """ 613 """
614 varns, varname = self._split_ns(varname)
615 if not varns:
616 if varname:
617 varnameparts = tuple([unquote(vp)
618 for vp in varname.split(_HIER_SEPARATOR)])
619 else:
620 varnameparts = tuple()
621 else:
622 varnameparts = (varname,)
614 try: 623 try:
615 obj = self.getvar(varname) 624 obj = self.getvarl(*varnameparts, namespace=varns)
616 return self.substitute_variables_in_obj(obj) 625 return self.substitute_variables_in_obj(obj)
617 except KeyError: 626 except KeyError:
618 if default is _MARKER: 627 if default is _MARKER:
619 raise 628 raise
620 else: 629 else: