diff --git a/3.0-HISTORY.rst b/3.0-HISTORY.rst new file mode 100644 index 00000000..178f0001 --- /dev/null +++ b/3.0-HISTORY.rst @@ -0,0 +1,11 @@ +3.0.0 (2015-xx-xx) +++++++++++++++++++ + +- Remove the ``__bool__`` and ``__nonzero__`` methods from a ``Response`` + object. + + This has been a planned feature for over a year. The behaviour is surprising + to most people and breaks most of the assumptions that people have about + Response objects. This resolves issue `#2002`_ + +.. _#2002: https://github.com/kennethreitz/requests/issues/2002 diff --git a/requests/models.py b/requests/models.py index 45b3ea96..e2055fe2 100644 --- a/requests/models.py +++ b/requests/models.py @@ -619,14 +619,6 @@ class Response(object): def __repr__(self): return '' % (self.status_code) - def __bool__(self): - """Returns true if :attr:`status_code` is 'OK'.""" - return self.ok - - def __nonzero__(self): - """Returns true if :attr:`status_code` is 'OK'.""" - return self.ok - def __iter__(self): """Allows you to use a response as an iterator.""" return self.iter_content(128)