Skip to content

Commit

Permalink
More updates for Django
Browse files Browse the repository at this point in the history
is_authenticated is no longer a function
  • Loading branch information
psvenk committed Dec 3, 2022
1 parent d836102 commit 47dba9d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion analytics/request_counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def process_response(self, request, response):
if len(user_agent) > 150:
user_agent = user_agent[:150]
tally.user_agent = user_agent
if hasattr(request, "user") and request.user and request.user.is_authenticated():
if hasattr(request, "user") and request.user and request.user.is_authenticated:
tally.is_authenticated = True
try:
student = request.user.student
Expand Down
4 changes: 2 additions & 2 deletions common/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def view_or_basicauth(view, request, test_func, realm = "", *args, **kwargs):
and returning the view if all goes well, otherwise responding with a 401.
"""

if request.user is None or not request.user.is_authenticated() or not user_has_student(request.user) or ALWAYS_LOGIN:
if request.user is None or not request.user.is_authenticated or not user_has_student(request.user) or ALWAYS_LOGIN:
key = 'HTTP_AUTHORIZATION'
if key not in request.META:
key = 'REDIRECT_HTTP_AUTHORIZATION'
Expand Down Expand Up @@ -101,7 +101,7 @@ def wrapper(request, *args, **kwargs):
if request.method == 'OPTIONS':
return HttpResponse()
return view_or_basicauth(func, request,
lambda u: u.is_authenticated(),
lambda u: u.is_authenticated,
realm, *args, **kwargs)
return wrapper

Expand Down
2 changes: 1 addition & 1 deletion requirements/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def save_change_request(form, type, list_id="", committed=False):

def is_staff(request):
"""Returns whether or not the request's user is an authenticated staff member."""
return request.user is not None and request.user.is_staff and request.user.is_authenticated()
return request.user is not None and request.user.is_staff and request.user.is_authenticated

def populate_initial_text(request, params, edit_req):
params['initial_text'] = edit_req.contents
Expand Down

0 comments on commit 47dba9d

Please sign in to comment.