Skip to content

Commit

Permalink
Merge pull request #893 from MongoEngine/topic/pop-default-argument
Browse files Browse the repository at this point in the history
Use dict.pop() default argument instead of checking if the key exists ourselves
  • Loading branch information
thedrow committed Mar 1, 2015
2 parents 4f1d867 + e5986e0 commit 7d1ba46
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions mongoengine/base/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,7 @@ def to_json(self, *args, **kwargs):
"""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
Expand Down

0 comments on commit 7d1ba46

Please sign in to comment.