Projet

Général

Profil

0001-misc-restore-usage-of-CallableTrue-41391.patch

Frédéric Péters, 06 avril 2020 21:25

Télécharger (1,94 ko)

Voir les différences:

Subject: [PATCH] misc: restore usage of CallableTrue (#41391)

This reverts commit ca5168f20367ea87b0b59ffc1dd5b94f8047625e, as it is
still required by djangorestframework 3.4 used in stretch.
 hobo/rest_authentication.py | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)
hobo/rest_authentication.py
8 8
from django.conf import settings
9 9
from django.contrib.auth.models import AnonymousUser
10 10
from django.db.models.fields import FieldDoesNotExist
11
try:
12
    from django.utils.deprecation import CallableTrue
13
except ImportError:
14
    CallableTrue = True
11 15
from django.utils.module_loading import import_string
12 16

  
13 17
try:
......
18 22

  
19 23
class AnonymousAuthenticServiceUser(AnonymousUser):
20 24
    '''This virtual user hold permissions for other publik services'''
21
    is_anonymous = True
22
    is_authenticated = True
25

  
26
    @property
27
    def is_anonymous(self):
28
        return CallableTrue
29

  
30
    @property
31
    def is_authenticated(self):
32
        return CallableTrue
23 33

  
24 34
    def has_perm(self, perm_or_perms, obj=None):
25 35
        return True
......
41 51
class AnonymousAdminServiceUser(AnonymousUser):
42 52
    '''This virtual user hold permissions for other publik services'''
43 53
    is_staff = True
44
    is_anonymous = True
45
    is_authenticated = True
54

  
55
    @property
56
    def is_anonymous(self):
57
        return CallableTrue
58

  
59
    @property
60
    def is_authenticated(self):
61
        return CallableTrue
46 62

  
47 63
    def __unicode__(self):
48 64
        return 'Publik Service Admin'
49
-