def get_course_topics(request, course_key, topic_ids=None):
 course = _get_course(course_key, request.user)
 (courseware_topics, existing_courseware_topic_ids) = get_courseware_topics(request, course_key, course, topic_ids)
 (non_courseware_topics, existing_non_courseware_topic_ids) = get_non_courseware_topics(request, course_key, course, topic_ids)
 if topic_ids:
  not_found_topic_ids = (topic_ids - (existing_courseware_topic_ids | existing_non_courseware_topic_ids))
  if not_found_topic_ids:
   raise DiscussionNotFoundError("Discussion not found for '{}'.".format(', '.join((str(id) for id in not_found_topic_ids))))
 return {'courseware_topics': courseware_topics, 'non_courseware_topics': non_courseware_topics}

def get_course_topics ( request , course_key , topic_ids = None ) : course = _get_course ( course_key , request . user ) ( courseware_topics , existing_courseware_topic_ids ) = get_courseware_topics ( request , course_key , course , topic_ids ) ( non_courseware_topics , existing_non_courseware_topic_ids ) = get_non_courseware_topics ( request , course_key , course , topic_ids ) if topic_ids : not_found_topic_ids = ( topic_ids - ( existing_courseware_topic_ids | existing_non_courseware_topic_ids ) ) if not_found_topic_ids : raise DiscussionNotFoundError ( "Discussion not found for '{}'." . format ( ', ' . join ( ( str ( id ) for id in not_found_topic_ids ) ) ) ) return { 'courseware_topics' : courseware_topics , 'non_courseware_topics' : non_courseware_topics }
returns the course topic listing for the given course and user; filtered by topic_ids list if given .