Skip to content

Commit 8be620a

Browse files
committed
More updates for Django
is_authenticated is no longer a function
1 parent fc131d3 commit 8be620a

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

analytics/request_counter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def process_response(self, request, response):
4343
if len(user_agent) > 150:
4444
user_agent = user_agent[:150]
4545
tally.user_agent = user_agent
46-
if hasattr(request, "user") and request.user and request.user.is_authenticated():
46+
if hasattr(request, "user") and request.user and request.user.is_authenticated:
4747
tally.is_authenticated = True
4848
try:
4949
student = request.user.student

common/decorators.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def view_or_basicauth(view, request, test_func, realm = "", *args, **kwargs):
2828
and returning the view if all goes well, otherwise responding with a 401.
2929
"""
3030

31-
if request.user is None or not request.user.is_authenticated() or not user_has_student(request.user) or ALWAYS_LOGIN:
31+
if request.user is None or not request.user.is_authenticated or not user_has_student(request.user) or ALWAYS_LOGIN:
3232
key = 'HTTP_AUTHORIZATION'
3333
if key not in request.META:
3434
key = 'REDIRECT_HTTP_AUTHORIZATION'
@@ -101,7 +101,7 @@ def wrapper(request, *args, **kwargs):
101101
if request.method == 'OPTIONS':
102102
return HttpResponse()
103103
return view_or_basicauth(func, request,
104-
lambda u: u.is_authenticated(),
104+
lambda u: u.is_authenticated,
105105
realm, *args, **kwargs)
106106
return wrapper
107107

requirements/editor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def save_change_request(form, type, list_id="", committed=False):
8787

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

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

0 commit comments

Comments
 (0)