Commit e5f97b37 by Sarina Canelake

pep8 fixes

parent b1424a75
...@@ -114,7 +114,7 @@ def inline_discussion(request, course_id, discussion_id): ...@@ -114,7 +114,7 @@ def inline_discussion(request, course_id, discussion_id):
threads, query_params = get_threads(request, course_id, discussion_id, per_page=INLINE_THREADS_PER_PAGE) threads, query_params = get_threads(request, course_id, discussion_id, per_page=INLINE_THREADS_PER_PAGE)
cc_user = cc.User.from_django_user(request.user) cc_user = cc.User.from_django_user(request.user)
user_info = cc_user.to_dict() user_info = cc_user.to_dict()
except (cc.utils.CommentClientError, cc.utils.CommentClientUnknownError) as err: except (cc.utils.CommentClientError, cc.utils.CommentClientUnknownError):
# TODO (vshnayder): since none of this code seems to be aware of the fact that # TODO (vshnayder): since none of this code seems to be aware of the fact that
# sometimes things go wrong, I suspect that the js client is also not # sometimes things go wrong, I suspect that the js client is also not
# checking for errors on request. Check and fix as needed. # checking for errors on request. Check and fix as needed.
...@@ -141,8 +141,8 @@ def inline_discussion(request, course_id, discussion_id): ...@@ -141,8 +141,8 @@ def inline_discussion(request, course_id, discussion_id):
if is_moderator: if is_moderator:
cohorts = get_course_cohorts(course_id) cohorts = get_course_cohorts(course_id)
for c in cohorts: for cohort in cohorts:
cohorts_list.append({'name': c.name, 'id': c.id}) cohorts_list.append({'name': cohort.name, 'id': cohort.id})
else: else:
#students don't get to choose #students don't get to choose
...@@ -174,11 +174,11 @@ def forum_form_discussion(request, course_id): ...@@ -174,11 +174,11 @@ def forum_form_discussion(request, course_id):
try: try:
unsafethreads, query_params = get_threads(request, course_id) # This might process a search query unsafethreads, query_params = get_threads(request, course_id) # This might process a search query
threads = [utils.safe_content(thread) for thread in unsafethreads] threads = [utils.safe_content(thread) for thread in unsafethreads]
except (cc.utils.CommentClientMaintenanceError) as err: except cc.utils.CommentClientMaintenanceError:
log.warning("Forum is in maintenance mode") log.warning("Forum is in maintenance mode")
return render_to_response('discussion/maintenance.html', {}) return render_to_response('discussion/maintenance.html', {})
except (cc.utils.CommentClientError, cc.utils.CommentClientUnknownError) as err: except (cc.utils.CommentClientError, cc.utils.CommentClientUnknownError) as err:
log.error("Error loading forum discussion threads: %s" % str(err)) log.error("Error loading forum discussion threads: %s", str(err))
raise Http404 raise Http404
user = cc.User.from_django_user(request.user) user = cc.User.from_django_user(request.user)
...@@ -244,7 +244,7 @@ def single_thread(request, course_id, discussion_id, thread_id): ...@@ -244,7 +244,7 @@ def single_thread(request, course_id, discussion_id, thread_id):
try: try:
thread = cc.Thread.find(thread_id).retrieve(recursive=True, user_id=request.user.id) thread = cc.Thread.find(thread_id).retrieve(recursive=True, user_id=request.user.id)
except (cc.utils.CommentClientError, cc.utils.CommentClientUnknownError) as err: except (cc.utils.CommentClientError, cc.utils.CommentClientUnknownError):
log.error("Error loading single thread.") log.error("Error loading single thread.")
raise Http404 raise Http404
...@@ -269,7 +269,7 @@ def single_thread(request, course_id, discussion_id, thread_id): ...@@ -269,7 +269,7 @@ def single_thread(request, course_id, discussion_id, thread_id):
try: try:
threads, query_params = get_threads(request, course_id) threads, query_params = get_threads(request, course_id)
threads.append(thread.to_dict()) threads.append(thread.to_dict())
except (cc.utils.CommentClientError, cc.utils.CommentClientUnknownError) as err: except (cc.utils.CommentClientError, cc.utils.CommentClientUnknownError):
log.error("Error loading single thread.") log.error("Error loading single thread.")
raise Http404 raise Http404
...@@ -369,7 +369,7 @@ def user_profile(request, course_id, user_id): ...@@ -369,7 +369,7 @@ def user_profile(request, course_id, user_id):
} }
return render_to_response('discussion/user_profile.html', context) return render_to_response('discussion/user_profile.html', context)
except (cc.utils.CommentClientError, cc.utils.CommentClientUnknownError, User.DoesNotExist) as err: except (cc.utils.CommentClientError, cc.utils.CommentClientUnknownError, User.DoesNotExist):
raise Http404 raise Http404
...@@ -412,5 +412,5 @@ def followed_threads(request, course_id, user_id): ...@@ -412,5 +412,5 @@ def followed_threads(request, course_id, user_id):
} }
return render_to_response('discussion/user_profile.html', context) return render_to_response('discussion/user_profile.html', context)
except (cc.utils.CommentClientError, cc.utils.CommentClientUnknownError, User.DoesNotExist) as err: except (cc.utils.CommentClientError, cc.utils.CommentClientUnknownError, User.DoesNotExist):
raise Http404 raise Http404
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