diff options
author | Dan Smith <danms@us.ibm.com> | 2013-06-26 09:51:12 -0700 |
---|---|---|
committer | Dan Smith <danms@us.ibm.com> | 2013-06-26 15:56:21 -0700 |
commit | f1c4b8e5f34eb6b5e70da6711750dcf05cea8c0a (patch) | |
tree | 62c57329123632da7774b0a6dc06eaf6bf40382c | |
parent | 68cb4d53385821c3ffdc40c299a77d11a7f98f27 (diff) | |
download | nova-f1c4b8e5f34eb6b5e70da6711750dcf05cea8c0a.tar.gz nova-f1c4b8e5f34eb6b5e70da6711750dcf05cea8c0a.tar.xz nova-f1c4b8e5f34eb6b5e70da6711750dcf05cea8c0a.zip |
Add update() method to NovaObject for dict compatibility
In order for objects to behave like dicts, they need to
support the update() method. This patch adds that.
Related to blueprint unified-object-model
Change-Id: Icb3932682285cbf8e7362e5b748e42a754b17fe7
-rw-r--r-- | nova/objects/base.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/nova/objects/base.py b/nova/objects/base.py index 4f973de0c..c6dc8cc1a 100644 --- a/nova/objects/base.py +++ b/nova/objects/base.py @@ -367,6 +367,14 @@ class NovaObject(object): """ return self[key] + def update(self, updates): + """For backwards-compatibility with dict-base objects. + + NOTE(danms): May be removed in the future. + """ + for key, value in updates.items(): + self[key] = value + class ObjectListBase(object): """Mixin class for lists of objects. |