New remove_none_attributes utility

Returns a new dict with all None values removed.
This commit is contained in:
2016-03-05 23:18:40 +01:00
parent bec21e14e6
commit bc1a146ef2
2 changed files with 23 additions and 2 deletions

View File

@@ -211,10 +211,11 @@ class Create(Resource):
>>> node = Node({})
>>> node.create()
"""
api = api or self.api
headers = self.http_headers()
new_attributes = api.post(self.path, self.to_dict(), headers)
attributes = utils.remove_none_attributes(self.to_dict())
new_attributes = api.post(self.path, attributes, headers)
self.error = None
self.merge(new_attributes)
return self.success()