Unset fields of API objects have None values instead of wsme.types.Unset
Bug #1385247 reported by
Vladyslav Drok
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Ironic |
Fix Released
|
Low
|
Vladyslav Drok |
Bug Description
In API objects constructors, e.g. in Node, fields initialization is done this way:
for k in fields:
# Skip fields we do not expose.
if not hasattr(self, k):
continue
self.
setattr(self, k, kwargs.get(k))
So, the field is set to None if it is passed to __init__ as None and if it is not passed at all.
If it's not passed at all it's better to use wsme.types.Unset instead of None, as it is its purpose:
setattr(self, k, kwargs.get(k, wsme.types.Unset))
so that these two cases can be distinguished.
Changed in ironic: | |
assignee: | nobody → Vladyslav Drok (vdrok) |
Changed in ironic: | |
status: | New → Triaged |
importance: | Undecided → Low |
Changed in ironic: | |
milestone: | none → kilo-1 |
status: | Fix Committed → Fix Released |
Changed in ironic: | |
milestone: | kilo-1 → 2015.1.0 |
To post a comment you must log in.
Fix proposed to branch: master /review. openstack. org/131139
Review: https:/