#NEWLINE# @ cache_page ( settings . ITEM_PAGE_CACHE_SECONDS ) #NEWLINE# def gmitem_json( request , gmbibid ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# bibid = voyager . get_bibid_from_gmid ( gmbibid ) #NEWLINE# if bibid : #NEWLINE# #INDENT# return redirect ( 'item_json' , bibid = bibid ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# bib_data = voyager . get_z3950_bib_data ( gmbibid , 'GM' ) #NEWLINE# if ( not bib_data ) : #NEWLINE# #INDENT# return HttpResponse ( '{}' , content_type = 'application/json' , status = 404 ) #NEWLINE# #UNINDENT# bib_data [ 'holdings' ] = voyager . get_holdings ( bib_data , 'GM' , False ) #NEWLINE# bib_data [ 'openurl' ] = _openurl_dict ( request ) #NEWLINE# bib_data [ 'citation_json' ] = citation_json ( request ) #NEWLINE# bib_encoded = unicode_data ( bib_data ) #NEWLINE# return HttpResponse ( json . dumps ( bib_encoded , default = _date_handler , indent = 2 ) , content_type = 'application/json' ) #NEWLINE# #UNINDENT# raise Http404 #NEWLINE# #UNINDENT# except DatabaseError : #NEWLINE# #INDENT# logger . exception ( ( 'unable to render gmbibid json: %s' % request ) ) #NEWLINE# return error500 ( request )