summaryrefslogtreecommitdiff
path: root/django/utils/tree.py
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2012-11-03 21:43:11 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2012-11-03 22:07:35 +0100
commitfc10418fba4fb906e4265650b62c510d526d63f7 (patch)
treee00dc8dfa531f03a9ba973e4da80d0f796e83733 /django/utils/tree.py
parent973f539ab83bb46645f2f711190735c66a246797 (diff)
downloaddjango-fc10418fba4fb906e4265650b62c510d526d63f7.tar.gz
Fixed #18963 -- Used a subclass-friendly pattern
for Python 2 object model compatibility methods.
Diffstat (limited to 'django/utils/tree.py')
-rw-r--r--django/utils/tree.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/django/utils/tree.py b/django/utils/tree.py
index 717181d2b9..ce490224e0 100644
--- a/django/utils/tree.py
+++ b/django/utils/tree.py
@@ -73,7 +73,9 @@ class Node(object):
For truth value testing.
"""
return bool(self.children)
- __nonzero__ = __bool__ # Python 2
+
+ def __nonzero__(self): # Python 2 compatibility
+ return type(self).__bool__(self)
def __contains__(self, other):
"""