comparison configmix/config.py @ 17:94b5e94fae44

Make the AttributeDict "private" (-> "_AttributeDict")
author Franz Glasner <f.glasner@feldmann-mg.com>
date Thu, 10 Mar 2016 10:42:55 +0100
parents f85dc4677c01
children a04fa81e10ae
comparison
equal deleted inserted replaced
16:f85dc4677c01 17:94b5e94fae44
22 22
23 23
24 _MARKER = object() 24 _MARKER = object()
25 25
26 26
27 class AttributeDict(ConfigurationBase): 27 class _AttributeDict(ConfigurationBase):
28 28
29 def __getattr__(self, name): 29 def __getattr__(self, name):
30 try: 30 try:
31 v = self[name] 31 v = self[name]
32 except KeyError: 32 except KeyError:
37 return AttributeDict(v) 37 return AttributeDict(v)
38 else: 38 else:
39 return v 39 return v
40 40
41 41
42 class Configuration(AttributeDict): 42 class Configuration(_AttributeDict):
43 43
44 def getvar(self, varname, default=_MARKER): 44 def getvar(self, varname, default=_MARKER):
45 """Get a variable of the form ``[[ns1.]ns2.]name`` - including 45 """Get a variable of the form ``[[ns1.]ns2.]name`` - including
46 variables from other namespaces. 46 variables from other namespaces.
47 47