From e5986e0ae20424c1b97c540ec5cbe630f364b99b Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Fri, 27 Feb 2015 11:18:09 +0200 Subject: [PATCH] Use dict.pop() default argument instead of checking if the key exists ourselves. --- mongoengine/base/document.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mongoengine/base/document.py b/mongoengine/base/document.py index 6bf38ee2..07b0a140 100644 --- a/mongoengine/base/document.py +++ b/mongoengine/base/document.py @@ -411,8 +411,7 @@ class BaseDocument(object): """Converts a document to JSON. :param use_db_field: Set to True by default but enables the output of the json structure with the field names and not the mongodb store db_names in case of set to False """ - use_db_field = kwargs.pop('use_db_field') if kwargs.has_key( - 'use_db_field') else True + use_db_field = kwargs.pop('use_db_field', True) return json_util.dumps(self.to_mongo(use_db_field), *args, **kwargs) @classmethod