Allow args and kwargs to be passed through to_json (#420)

This commit is contained in:
Ross Lawley
2013-07-29 15:29:48 +00:00
parent a458d5a176
commit 67f43b2aad
3 changed files with 8 additions and 4 deletions

View File

@@ -321,9 +321,9 @@ class BaseDocument(object):
message = "ValidationError (%s:%s) " % (self._class_name, pk)
raise ValidationError(message, errors=errors)
def to_json(self):
def to_json(self, *args, **kwargs):
"""Converts a document to JSON"""
return json_util.dumps(self.to_mongo())
return json_util.dumps(self.to_mongo(), *args, **kwargs)
@classmethod
def from_json(cls, json_data):