magic-removal: moved django.parts.auth.anonymoususers.AnonymousUser to django.contrib.auth.models.AnonymousUser

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2494 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Joseph Kocherhans 2006-03-07 01:53:20 +00:00
parent bc851653b7
commit dc63d91c56
5 changed files with 48 additions and 47 deletions

View File

@ -25,6 +25,6 @@ class AuthenticationMiddleware:
user_id = request.session[SESSION_KEY]
request.user = UserWrapper(user_id)
except KeyError:
from django.parts.auth.anonymoususers import AnonymousUser
from django.contrib.auth.models import AnonymousUser
request.user = AnonymousUser()
return None

View File

@ -220,3 +220,48 @@ class Message(models.Model):
def __repr__(self):
return self.message
class AnonymousUser:
id = None
def __init__(self):
pass
def __repr__(self):
return 'AnonymousUser'
def save(self):
raise NotImplementedError
def delete(self):
raise NotImplementedError
def set_password(self, raw_password):
raise NotImplementedError
def check_password(self, raw_password):
raise NotImplementedError
def get_group_list(self):
return []
def set_groups(self, group_id_list):
raise NotImplementedError
def get_permission_list(self):
return []
def set_permissions(self, permission_id_list):
raise NotImplementedError
def has_perm(self, perm):
return False
def has_module_perms(self, module):
return False
def get_and_delete_messages(self):
return []
def is_anonymous(self):
return True

View File

@ -1,44 +0,0 @@
class AnonymousUser:
id = None
def __init__(self):
pass
def __repr__(self):
return 'AnonymousUser'
def save(self):
raise NotImplementedError
def delete(self):
raise NotImplementedError
def set_password(self, raw_password):
raise NotImplementedError
def check_password(self, raw_password):
raise NotImplementedError
def get_group_list(self):
return []
def set_groups(self, group_id_list):
raise NotImplementedError
def get_permission_list(self):
return []
def set_permissions(self, permission_id_list):
raise NotImplementedError
def has_perm(self, perm):
return False
def has_module_perms(self, module):
return False
def get_and_delete_messages(self):
return []
def is_anonymous(self):
return True

View File

@ -192,7 +192,7 @@ the setting and checking of these values behind the scenes.
Anonymous users
---------------
``django.parts.auth.anonymoususers.AnonymousUser`` is a class that implements
``django.contrib.auth.models.AnonymousUser`` is a class that implements
the ``django.models.auth.users.User`` interface, with these differences:
* ``id`` is always ``None``.

View File

@ -88,7 +88,7 @@ All attributes except ``session`` should be considered read-only.
``user``
A ``django.models.auth.users.User`` object representing the currently
logged-in user. If the user isn't currently logged in, ``user`` will be set
to an instance of ``django.parts.auth.anonymoususers.AnonymousUser``. You
to an instance of ``django.contrib.auth.models.AnonymousUser``. You
can tell them apart with ``is_anonymous()``, like so::
if request.user.is_anonymous():