From cdd484b0fd4f9d6f20d321469832e48cfd35f3d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 18 Apr 2019 17:12:22 +0200 Subject: [PATCH] Use remove_private_keys() instead of explicitly popping off certain keys --- pillarsdk/projects.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pillarsdk/projects.py b/pillarsdk/projects.py index 6863dfd..601e840 100644 --- a/pillarsdk/projects.py +++ b/pillarsdk/projects.py @@ -51,19 +51,16 @@ class Project(List, Find, Create, Post, Update, Delete, Replace): api = api or self.api attributes = attributes or self.to_dict() etag = attributes['_etag'] - attributes.pop('_id') - attributes.pop('_etag') - attributes.pop('_created', None) - attributes.pop('_updated', None) - attributes.pop('_links', None) - attributes.pop('_deleted', None) attributes.pop('allowed_methods', None) + # Strip embedded image file properties and revert to ObjectId for prop in ['picture_square', 'picture_header']: if prop in attributes and type(attributes[prop]) is dict: attributes[prop] = attributes[prop]['_id'] # Remove None attributes attributes = utils.remove_none_attributes(attributes) + attributes = utils.remove_private_keys(attributes) + url = utils.join_url(self.path, str(self['_id'])) headers = utils.merge_dict( self.http_headers(),