Commit 2f9ca026 authored by Jameson Graef Rollins's avatar Jameson Graef Rollins

fix to Struct.__setitem__ to support setting nested value

parent 7a1c8732
Pipeline #29184 passed with stages
in 1 minute and 4 seconds
......@@ -101,7 +101,11 @@ class Struct(object):
return default
def __setitem__(self, key, value):
self.__dict__[key] = value
if '.' in key:
k, r = key.split('.', 1)
self.__dict__[k][r] = value
else:
self.__dict__[key] = value
def setdefault(self, key, default):
return self.__dict__.setdefault(key, default)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment