Use remove_private_keys() instead of explicitly popping off certain keys
This commit is contained in:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user