Skip to content
Snippets Groups Projects
Commit 2f9ca026 authored by Jameson Graef Rollins's avatar Jameson Graef Rollins
Browse files

fix to Struct.__setitem__ to support setting nested value

parent 7a1c8732
No related branches found
No related tags found
No related merge requests found
Pipeline #29184 passed
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment