Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
44a8f31d
Commit
44a8f31d
authored
Dec 06, 2012
by
Victor Shnayder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change are-we-logged-in detection to be less hackish.
- has matching changes in controller staff_grading view.
parent
730cdd3b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
lms/djangoapps/instructor/staff_grading_service.py
+6
-5
No files found.
lms/djangoapps/instructor/staff_grading_service.py
View file @
44a8f31d
...
...
@@ -77,15 +77,16 @@ class StaffGradingService(object):
def
_try_with_login
(
self
,
operation
):
"""
Call operation(), which should return a requests response object. If
the response status code is 302, call _login() and try the operation
again. NOTE: use requests.get(..., allow_redirects=False) to have
requests not auto-follow redirects.
the request fails with a 'login_required' error, call _login() and try
the operation again.
Returns the result of operation(). Does not catch exceptions.
"""
response
=
operation
()
if
response
.
status_code
==
302
:
# redirect means we aren't logged in
if
(
response
.
json
and
response
.
json
.
get
(
'success'
)
==
False
and
response
.
json
.
get
(
'error'
)
==
'login_required'
):
# apparrently we aren't logged in. Try to fix that.
r
=
self
.
_login
()
if
r
and
not
r
.
get
(
'success'
):
log
.
warning
(
"Couldn't log into staff_grading backend. Response:
%
s"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment