summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorAdam Chainz <adam@adamj.eu>2016-08-05 14:18:12 +0100
committerTim Graham <timograham@gmail.com>2016-08-16 17:17:34 -0400
commit19e20a2a3f763388bba9263d56db34012e90cf5b (patch)
tree379f35ef5f47bbc5bef0483ca81de5b555edb507 /django
parent68b580323bc1d29282c25f7f729032997674d47c (diff)
Fixed crash comparing CheckMessage objects to non-CheckMessage objects.
Diffstat (limited to 'django')
-rw-r--r--django/core/checks/messages.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/django/core/checks/messages.py b/django/core/checks/messages.py
index 23e9d5a794..345ebec1e1 100644
--- a/django/core/checks/messages.py
+++ b/django/core/checks/messages.py
@@ -23,8 +23,11 @@ class CheckMessage(object):
self.id = id
def __eq__(self, other):
- return all(getattr(self, attr) == getattr(other, attr)
- for attr in ['level', 'msg', 'hint', 'obj', 'id'])
+ return (
+ isinstance(other, self.__class__) and
+ all(getattr(self, attr) == getattr(other, attr)
+ for attr in ['level', 'msg', 'hint', 'obj', 'id'])
+ )
def __ne__(self, other):
return not (self == other)