def is_commentable_cohorted(course_key, commentable_id):
 course = courses.get_course_by_id(course_key)
 course_cohort_settings = get_course_cohort_settings(course_key)
 if ((not course_cohort_settings.is_cohorted) or get_team(commentable_id)):
  ans = False
 elif ((commentable_id in course.top_level_discussion_topic_ids) or (course_cohort_settings.always_cohort_inline_discussions is False)):
  ans = (commentable_id in course_cohort_settings.cohorted_discussions)
 else:
  ans = True
 log.debug(u'is_commentable_cohorted(%s, %s) = {%s}', course_key, commentable_id, ans)
 return ans

def is_commentable_cohorted ( course_key , commentable_id ) : course = courses . get_course_by_id ( course_key ) course_cohort_settings = get_course_cohort_settings ( course_key ) if ( ( not course_cohort_settings . is_cohorted ) or get_team ( commentable_id ) ) : ans = False elif ( ( commentable_id in course . top_level_discussion_topic_ids ) or ( course_cohort_settings . always_cohort_inline_discussions is False ) ) : ans = ( commentable_id in course_cohort_settings . cohorted_discussions ) else : ans = True log . debug ( u'is_commentable_cohorted(%s, %s) = {%s}' , course_key , commentable_id , ans ) return ans
args: course_key: coursekey commentable_id: string returns: bool: is this commentable cohorted? raises: http404 if the course doesnt exist .