Skip to content

Commit

Permalink
Updates to the ConfigBlock
Browse files Browse the repository at this point in the history
Fixes:
 - adding missing API
 - adding ConfigDict -> ConfigBlock alias
 - Fixing the update of default values when basing one ConfigBlock on another.
  • Loading branch information
jsiirola committed Oct 26, 2018
1 parent 7f0d965 commit 520aae9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pyutilib/misc/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def __setstate__(self, state):

def __call__(self, value=NoArgument):
ans = self.__class__()
ans._default = self._default
ans._default = self.value()
ans._domain = self._domain
ans._description = self._description
ans._doc = self._doc
Expand Down Expand Up @@ -209,6 +209,13 @@ def name(self, fully_qualified=False):
else:
return self._name

def set_default_value(self, default):
self._default = default

def set_domain(self, domain):
self._domain = domain
self.set_value(self.value(accessValue=False))

def _cast(self, value):
if value is None:
return value
Expand Down Expand Up @@ -959,6 +966,10 @@ def _data_collector(self, level, prefix, visibility=None, docMode=False):
visibility, docMode):
yield v

# Future-proofing: We will be renaming the ConfigBlock to ConfigDict in
# the future
ConfigDict = ConfigBlock

# In Python3, the items(), etc methods of dict-like things return
# generator-like objects.
if six.PY3:
Expand Down

0 comments on commit 520aae9

Please sign in to comment.