Add .new() for adding keys to rw configs

This commit is contained in:
Tim Van Baak 2020-01-20 17:24:01 -08:00
parent 085ac63da8
commit 8c70067076

View File

@ -20,6 +20,12 @@ class AttrOrderedDict(OrderedDict):
raise AttributeError(key)
self[key] = value
def new(self, key, value):
"""Setter for adding new keys"""
if key in self:
raise KeyError("Key already exists: '{}'".format(key))
self[key] = value
class ReadOnlyOrderedDict(OrderedDict):
"""An ordered dictionary that cannot be modified"""