summaryrefslogtreecommitdiff
path: root/tox.ini
diff options
context:
space:
mode:
authorMark Goddard <mark@stackhpc.com>2018-02-19 13:29:45 +0000
committerRuby Loo <ruby.loo@intel.com>2018-02-22 00:29:58 +0000
commitc66679f14b0b5f34462a896c3bff5a9f483a9a83 (patch)
treea3aca26e5c150174a93eba7028c949c22feeaf8a /tox.ini
parentb0a25516da622a0dd51b866b413cf67285fe1ca7 (diff)
downloadironic-c66679f14b0b5f34462a896c3bff5a9f483a9a83.tar.gz
Support nested objects and object lists in as_dict
The value returned by ironic.objects.IronicObject.as_dict() should be a plain object, in order for it to be serialised to JSON. Currently, nested object fields and object list fields are not converted to dict format. This caused problems during cleaning, when the node object's as_dict representation is JSON encoded and sent to IPA. This change adds support for calling as_dict() on nested objects and list objects, to ensure these are also returned in dict form. We also change the method used in as_dict() for checking whether an object has an attribute. The hasattr() function used previously has problems when used with properties in python 2 [1], in that any exceptions raised in the property getter result in hasattr() returning False. Instead we use obj_attr_is_set() to determine whether the object has a particular attribute. [1] https://hynek.me/articles/hasattr/ Change-Id: Ib2166040508827db28d6f6e2d9a3e655c16f2993 Closes-Bug: #1750027
Diffstat (limited to 'tox.ini')
0 files changed, 0 insertions, 0 deletions