summaryrefslogtreecommitdiffstats
path: root/testapi/opnfv_testapi/models/base_models.py
diff options
context:
space:
mode:
Diffstat (limited to 'testapi/opnfv_testapi/models/base_models.py')
-rw-r--r--testapi/opnfv_testapi/models/base_models.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/testapi/opnfv_testapi/models/base_models.py b/testapi/opnfv_testapi/models/base_models.py
index 5017e85..efce0ad 100644
--- a/testapi/opnfv_testapi/models/base_models.py
+++ b/testapi/opnfv_testapi/models/base_models.py
@@ -42,15 +42,16 @@ class ModelBase(object):
attr_parser = cls.attr_parser()
t = cls()
for k, v in a_dict.iteritems():
- value = v
- if isinstance(v, dict) and k in attr_parser:
- value = attr_parser[k].from_dict(v)
- elif isinstance(v, list) and k in attr_parser:
- value = []
- for item in v:
- value.append(attr_parser[k].from_dict(item))
-
- t.__setattr__(k, value)
+ if k in t.__dict__:
+ value = v
+ if isinstance(v, dict) and k in attr_parser:
+ value = attr_parser[k].from_dict(v)
+ elif isinstance(v, list) and k in attr_parser:
+ value = []
+ for item in v:
+ value.append(attr_parser[k].from_dict(item))
+
+ t.__setattr__(k, value)
return t