Use remove_private_keys() instead of popping predefined keys

This commit is contained in:
2019-05-31 17:02:48 +02:00
parent 65e0ad1ad3
commit 04761f09c6

View File

@@ -338,12 +338,8 @@ class Update(Resource):
api = api or self.api
attributes = attributes or self.to_dict()
etag = attributes['_etag']
attributes.pop('_id')
attributes.pop('_etag')
attributes.pop('_created')
attributes.pop('_updated')
attributes.pop('_links', None)
attributes.pop('_deleted', None)
attributes = utils.remove_private_keys(attributes)
attributes = utils.remove_none_attributes(attributes)
url = utils.join_url(self.path, str(self['_id']))
headers = utils.merge_dict(
@@ -369,12 +365,7 @@ class Replace(Resource):
api = api or self.api
attributes = attributes or self.to_dict()
etag = attributes['_etag']
attributes.pop('_id')
attributes.pop('_etag')
attributes.pop('_created')
attributes.pop('_updated')
attributes.pop('_links', None)
attributes.pop('_deleted', None)
attributes = utils.remove_private_keys(attributes)
if 'parent' in attributes:
attributes.pop('parent')
url = utils.join_url(self.path, str(self['_id']))