@login_required
def _get_item_in_course(request, usage_key):
 usage_key = usage_key.replace(course_key=modulestore().fill_in_run(usage_key.course_key))
 course_key = usage_key.course_key
 if (not has_course_author_access(request.user, course_key)):
  raise PermissionDenied()
 course = modulestore().get_course(course_key)
 item = modulestore().get_item(usage_key, depth=1)
 lms_link = get_lms_link_for_item(item.location)
 preview_lms_link = get_lms_link_for_item(item.location, preview=True)
 return (course, item, lms_link, preview_lms_link)

@ login_required def _get_item_in_course ( request , usage_key ) : usage_key = usage_key . replace ( course_key = modulestore ( ) . fill_in_run ( usage_key . course_key ) ) course_key = usage_key . course_key if ( not has_course_author_access ( request . user , course_key ) ) : raise PermissionDenied ( ) course = modulestore ( ) . get_course ( course_key ) item = modulestore ( ) . get_item ( usage_key , depth = 1 ) lms_link = get_lms_link_for_item ( item . location ) preview_lms_link = get_lms_link_for_item ( item . location , preview = True ) return ( course , item , lms_link , preview_lms_link )
helper method for getting the old location .