pyconfs icon indicating copy to clipboard operation
pyconfs copied to clipboard

Bug: Can't update config section to a list of sections

Open gahjelle opened this issue 3 years ago • 0 comments

Example:

>>> from pyconfs import Configuration
>>> cfg = Configuration.from_dict({"a": {"b": 1}})
>>> cfg.a = [cfg.a]

This fails with a message AttributeError: Configuration a has no entry 'update_from_list'. The issue is that the key a does not get updated to be a ConfigurationList instead of a Configuration in update_entry():

elif isinstance(value, (list, UserList)) and _is_nested(value):
    self.data.setdefault(key, ConfigurationList(name=name, _vars=self.vars))
    self.data[key].update_from_list(value, source=source)

gahjelle avatar Nov 22 '21 09:11 gahjelle