mirror of
https://github.com/django/django.git
synced 2025-03-11 09:52:38 +00:00
Fixed #2937 -- Added __eq__, __ne__ and __hash__ for AnonymousUser. Thanks, favo@exoweb.net
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3924 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
cacbedee27
commit
179d410a7a
@ -270,6 +270,15 @@ class AnonymousUser(object):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return 'AnonymousUser'
|
return 'AnonymousUser'
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
return isinstance(other, self.__class__)
|
||||||
|
|
||||||
|
def __ne__(self, other):
|
||||||
|
return not self.__eq__(other)
|
||||||
|
|
||||||
|
def __hash__(self):
|
||||||
|
return 1 # instances always return the same hash value
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user