Commit eafa6b22 by Sarina Canelake

Fix call to cohorts

parent 7f9839b9
...@@ -34,7 +34,7 @@ def split_by_comma_and_whitespace(s): ...@@ -34,7 +34,7 @@ def split_by_comma_and_whitespace(s):
@ensure_csrf_cookie @ensure_csrf_cookie
def list_cohorts(request, course_key): def list_cohorts(request, course_key_string):
""" """
Return json dump of dict: Return json dump of dict:
...@@ -43,7 +43,7 @@ def list_cohorts(request, course_key): ...@@ -43,7 +43,7 @@ def list_cohorts(request, course_key):
""" """
# this is a string when we get it here # this is a string when we get it here
course_key = SlashSeparatedCourseKey.from_deprecated_string(course_key) course_key = SlashSeparatedCourseKey.from_deprecated_string(course_key_string)
get_course_with_access(request.user, 'staff', course_key) get_course_with_access(request.user, 'staff', course_key)
...@@ -56,7 +56,7 @@ def list_cohorts(request, course_key): ...@@ -56,7 +56,7 @@ def list_cohorts(request, course_key):
@ensure_csrf_cookie @ensure_csrf_cookie
@require_POST @require_POST
def add_cohort(request, course_key): def add_cohort(request, course_key_string):
""" """
Return json of dict: Return json of dict:
{'success': True, {'success': True,
...@@ -69,7 +69,7 @@ def add_cohort(request, course_key): ...@@ -69,7 +69,7 @@ def add_cohort(request, course_key):
'msg': error_msg} if there's an error 'msg': error_msg} if there's an error
""" """
# this is a string when we get it here # this is a string when we get it here
course_key = SlashSeparatedCourseKey.from_deprecated_string(course_key) course_key = SlashSeparatedCourseKey.from_deprecated_string(course_key_string)
get_course_with_access(request.user, 'staff', course_key) get_course_with_access(request.user, 'staff', course_key)
...@@ -92,7 +92,7 @@ def add_cohort(request, course_key): ...@@ -92,7 +92,7 @@ def add_cohort(request, course_key):
@ensure_csrf_cookie @ensure_csrf_cookie
def users_in_cohort(request, course_key, cohort_id): def users_in_cohort(request, course_key_string, cohort_id):
""" """
Return users in the cohort. Show up to 100 per page, and page Return users in the cohort. Show up to 100 per page, and page
using the 'page' GET attribute in the call. Format: using the 'page' GET attribute in the call. Format:
...@@ -106,7 +106,7 @@ def users_in_cohort(request, course_key, cohort_id): ...@@ -106,7 +106,7 @@ def users_in_cohort(request, course_key, cohort_id):
} }
""" """
# this is a string when we get it here # this is a string when we get it here
course_key = SlashSeparatedCourseKey.from_deprecated_string(course_key) course_key = SlashSeparatedCourseKey.from_deprecated_string(course_key_string)
get_course_with_access(request.user, 'staff', course_key) get_course_with_access(request.user, 'staff', course_key)
...@@ -140,7 +140,7 @@ def users_in_cohort(request, course_key, cohort_id): ...@@ -140,7 +140,7 @@ def users_in_cohort(request, course_key, cohort_id):
@ensure_csrf_cookie @ensure_csrf_cookie
@require_POST @require_POST
def add_users_to_cohort(request, course_key, cohort_id): def add_users_to_cohort(request, course_key_string, cohort_id):
""" """
Return json dict of: Return json dict of:
...@@ -156,7 +156,7 @@ def add_users_to_cohort(request, course_key, cohort_id): ...@@ -156,7 +156,7 @@ def add_users_to_cohort(request, course_key, cohort_id):
'unknown': [str1, str2, ...]} 'unknown': [str1, str2, ...]}
""" """
# this is a string when we get it here # this is a string when we get it here
course_key = SlashSeparatedCourseKey.from_deprecated_string(course_key) course_key = SlashSeparatedCourseKey.from_deprecated_string(course_key_string)
get_course_with_access(request.user, 'staff', course_key) get_course_with_access(request.user, 'staff', course_key)
cohort = cohorts.get_cohort_by_id(course_key, cohort_id) cohort = cohorts.get_cohort_by_id(course_key, cohort_id)
...@@ -196,7 +196,7 @@ def add_users_to_cohort(request, course_key, cohort_id): ...@@ -196,7 +196,7 @@ def add_users_to_cohort(request, course_key, cohort_id):
@ensure_csrf_cookie @ensure_csrf_cookie
@require_POST @require_POST
def remove_user_from_cohort(request, course_key, cohort_id): def remove_user_from_cohort(request, course_key_string, cohort_id):
""" """
Expects 'username': username in POST data. Expects 'username': username in POST data.
...@@ -207,7 +207,7 @@ def remove_user_from_cohort(request, course_key, cohort_id): ...@@ -207,7 +207,7 @@ def remove_user_from_cohort(request, course_key, cohort_id):
'msg': error_msg} 'msg': error_msg}
""" """
# this is a string when we get it here # this is a string when we get it here
course_key = SlashSeparatedCourseKey.from_deprecated_string(course_key) course_key = SlashSeparatedCourseKey.from_deprecated_string(course_key_string)
get_course_with_access(request.user, 'staff', course_key) get_course_with_access(request.user, 'staff', course_key)
username = request.POST.get('username') username = request.POST.get('username')
...@@ -226,12 +226,12 @@ def remove_user_from_cohort(request, course_key, cohort_id): ...@@ -226,12 +226,12 @@ def remove_user_from_cohort(request, course_key, cohort_id):
'msg': "No user '{0}'".format(username)}) 'msg': "No user '{0}'".format(username)})
def debug_cohort_mgmt(request, course_key): def debug_cohort_mgmt(request, course_key_string):
""" """
Debugging view for dev. Debugging view for dev.
""" """
# this is a string when we get it here # this is a string when we get it here
course_key = SlashSeparatedCourseKey.from_deprecated_string(course_key) course_key = SlashSeparatedCourseKey.from_deprecated_string(course_key_string)
# add staff check to make sure it's safe if it's accidentally deployed. # add staff check to make sure it's safe if it's accidentally deployed.
get_course_with_access(request.user, 'staff', course_key) get_course_with_access(request.user, 'staff', course_key)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment