deprecate explain's format param

This commit is contained in:
Stefan Wojcik 2016-12-10 20:09:19 -05:00
parent 5b70a451c4
commit 500b182d17

View File

@ -977,8 +977,15 @@ class BaseQuerySet(object):
:param format: format the plan before returning it :param format: format the plan before returning it
""" """
plan = self._cursor.explain() plan = self._cursor.explain()
# TODO remove this option completely - it's useless. If somebody
# wants to pretty-print the output, they easily can.
if format: if format:
msg = ('"format" param of BaseQuerySet.explain has been '
'deprecated and will be removed in future versions.')
warnings.warn(msg, DeprecationWarning)
plan = pprint.pformat(plan) plan = pprint.pformat(plan)
return plan return plan
# DEPRECATED. Has no more impact on PyMongo 3+ # DEPRECATED. Has no more impact on PyMongo 3+