[py3] Replaced __nonzero__ by __bool__

Of course, __nonzero__ alias has been kept for Python 2 compatibility.
This commit is contained in:
Claude Paroz 2012-08-08 14:52:21 +02:00
parent 12cda89ffe
commit 576ec12f8e
7 changed files with 15 additions and 8 deletions

View file

@ -230,7 +230,7 @@ It is optimal because:
#. Use of :ttag:`with` means that we store ``user.emails.all`` in a variable
for later use, allowing its cache to be re-used.
#. The line ``{% if emails %}`` causes ``QuerySet.__nonzero__()`` to be called,
#. The line ``{% if emails %}`` causes ``QuerySet.__bool__()`` to be called,
which causes the ``user.emails.all()`` query to be run on the database, and
at the least the first line to be turned into an ORM object. If there aren't
any results, it will return False, otherwise True.