Merge pull request #893 from MongoEngine/topic/pop-default-argument
Use dict.pop() default argument instead of checking if the key exists ourselves
This commit is contained in:
		| @@ -414,8 +414,7 @@ class BaseDocument(object): | |||||||
|         """Converts a document to JSON. |         """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 |         :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 = kwargs.pop('use_db_field', True) | ||||||
|             'use_db_field') else True |  | ||||||
|         return json_util.dumps(self.to_mongo(use_db_field),  *args, **kwargs) |         return json_util.dumps(self.to_mongo(use_db_field),  *args, **kwargs) | ||||||
|  |  | ||||||
|     @classmethod |     @classmethod | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user