Ticket #7304: 7304.patch

File 7304.patch, 1.3 KB (added by Matthias Kestenholz, 16 years ago)
  • django/contrib/auth/models.py

    diff --git a/django/contrib/auth/models.py b/django/contrib/auth/models.py
    index a0ed4f3..3ea184a 100644
    a b class AnonymousUser(object):  
    358358    def has_perm(self, perm):
    359359        return False
    360360
     361    def has_perms(self, perm_list):
     362        return False
     363
    361364    def has_module_perms(self, module):
    362365        return False
    363366
  • tests/regressiontests/auth_backends/tests.py

    diff --git a/tests/regressiontests/auth_backends/tests.py b/tests/regressiontests/auth_backends/tests.py
    index 3ec2a05..045aa81 100644
    a b except NameError:  
    44    from sets import Set as set     # Python 2.3 fallback
    55
    66__test__ = {'API_TESTS': """
    7 >>> from django.contrib.auth.models import User, Group, Permission
     7>>> from django.contrib.auth.models import User, Group, Permission, AnonymousUser
    88>>> from django.contrib.contenttypes.models import ContentType
    99
    1010# No Permissions assigned yet, should return False except for superuser
    True  
    6969True
    7070>>> user.has_perms(['auth.test3', 'auth.test_group'])
    7171True
     72
     73# testing permissions of AnonymousUser
     74>>> user = AnonymousUser()
     75>>> user.has_perm('test')
     76False
     77>>> user.has_perms(['auth.test2', 'auth.test3'])
     78False
    7279"""}
Back to Top