@request_cached
def get_cached_discussion_key(course_id, discussion_id):
 try:
  mapping = CourseStructure.objects.get(course_id=course_id).discussion_id_map
  if (not mapping):
   raise DiscussionIdMapIsNotCached()
  return mapping.get(discussion_id)
 except CourseStructure.DoesNotExist:
  raise DiscussionIdMapIsNotCached()

@ request_cached def get_cached_discussion_key ( course_id , discussion_id ) : try : mapping = CourseStructure . objects . get ( course_id = course_id ) . discussion_id_map if ( not mapping ) : raise DiscussionIdMapIsNotCached ( ) return mapping . get ( discussion_id ) except CourseStructure . DoesNotExist : raise DiscussionIdMapIsNotCached ( )
returns the usage key of the discussion xblock associated with discussion_id if it is cached .