Ticket #3032: anonymous-user-properties.diff
File anonymous-user-properties.diff, 2.3 KB (added by , 17 years ago) |
---|
-
django/db/models/manager.py
111 111 if instance != None: 112 112 raise AttributeError, "Manager isn't accessible via %s instances" % type.__name__ 113 113 return self.manager 114 115 class EmptyManager(Manager): 116 def get_query_set(self): 117 return self.get_empty_query_set() -
django/contrib/auth/models.py
1 1 from django.core import validators 2 2 from django.core.exceptions import ImproperlyConfigured 3 3 from django.db import connection, models 4 from django.db.models.manager import EmptyManager 4 5 from django.contrib.contenttypes.models import ContentType 5 6 from django.utils.encoding import smart_str 6 7 from django.utils.translation import ugettext_lazy as _ … … 293 294 class AnonymousUser(object): 294 295 id = None 295 296 username = '' 297 is_staff = False 298 is_active = True 299 is_superuser = False 300 _groups = EmptyManager() 301 _user_permissions = EmptyManager() 296 302 297 303 def __init__(self): 298 304 pass … … 325 331 raise NotImplementedError 326 332 327 333 def _get_groups(self): 328 r aise NotImplementedError334 return self._groups 329 335 groups = property(_get_groups) 330 336 331 337 def _get_user_permissions(self): 332 r aise NotImplementedError338 return self._user_permissions 333 339 user_permissions = property(_get_user_permissions) 334 340 335 341 def has_perm(self, perm): -
docs/authentication.txt
244 244 the ``django.contrib.auth.models.User`` interface, with these differences: 245 245 246 246 * ``id`` is always ``None``. 247 * ``is_staff`` and ``is_superuser`` are always False 248 * ``is_active`` is always True 249 * ``groups`` and ``user_permissions`` are always empty 247 250 * ``is_anonymous()`` returns ``True`` instead of ``False``. 248 251 * ``is_authenticated()`` returns ``False`` instead of ``True``. 249 252 * ``has_perm()`` always returns ``False``.