def _display_library(library_key_string, request):
 library_key = CourseKey.from_string(library_key_string)
 if (not isinstance(library_key, LibraryLocator)):
  log.exception('Non-library key passed to content libraries API.')
  raise Http404
 if (not has_studio_read_access(request.user, library_key)):
  log.exception(u'User %s tried to access library %s without permission', request.user.username, unicode(library_key))
  raise PermissionDenied()
 library = modulestore().get_library(library_key)
 if (library is None):
  log.exception(u'Library %s not found', unicode(library_key))
  raise Http404
 response_format = 'html'
 if ((request.GET.get('format', 'html') == 'json') or ('application/json' in request.META.get('HTTP_ACCEPT', 'text/html'))):
  response_format = 'json'
 return library_blocks_view(library, request.user, response_format)

def _display_library ( library_key_string , request ) : library_key = CourseKey . from_string ( library_key_string ) if ( not isinstance ( library_key , LibraryLocator ) ) : log . exception ( 'Non-library key passed to content libraries API.' ) raise Http404 if ( not has_studio_read_access ( request . user , library_key ) ) : log . exception ( u'User %s tried to access library %s without permission' , request . user . username , unicode ( library_key ) ) raise PermissionDenied ( ) library = modulestore ( ) . get_library ( library_key ) if ( library is None ) : log . exception ( u'Library %s not found' , unicode ( library_key ) ) raise Http404 response_format = 'html' if ( ( request . GET . get ( 'format' , 'html' ) == 'json' ) or ( 'application/json' in request . META . get ( 'HTTP_ACCEPT' , 'text/html' ) ) ) : response_format = 'json' return library_blocks_view ( library , request . user , response_format )
displays single library .