fhir-py
fhir-py copied to clipboard
Unable to use items() on AttrDict
original = {"nested": {"items": {}}}
original.items() # => dict_items([('nested', {'items': {}})])
client.resource("CustomResource", **original).serialize().items() # => TypeError: 'AttrDict' object is not callable
client.resource("CustomResource", **original)['nested'].items() # => TypeError: 'AttrDict' object is not callable
And the most important case, it's impossible save this resource because it makes serialize() and then json.dumps()
client.resource("CustomResource", **original).save() # => TypeError
@ir4y the root of the issue is attr access via dot. Personally, I don't like this approach, dict must have dict behavior.
But it's too late to get rid of it. We need to find a workaround, at least, serialize() should return pure dict instead of AttrDict
Similar issues caused by attr access: #59