From 04761f09c6783baca8e3e6f57712cef1a1e732b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 31 May 2019 17:02:48 +0200 Subject: [PATCH] Use remove_private_keys() instead of popping predefined keys --- pillarsdk/resource.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/pillarsdk/resource.py b/pillarsdk/resource.py index 83d1ad2..39914c2 100644 --- a/pillarsdk/resource.py +++ b/pillarsdk/resource.py @@ -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']))