#NEWLINE# @ weblab_api . route_web ( '/labview/' ) #NEWLINE# def labview( ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# reservation_id = get_argument ( SESSION_ID ) #NEWLINE# if ( reservation_id is None ) : #NEWLINE# #INDENT# return ( HTML_TEMPLATE % { #NEWLINE# #INDENT# 'MESSAGE' : ( 'Failed to load LabVIEW experiment. Reason: %s argument not provided!.' % SESSION_ID ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# weblab_api . ctx . reservation_id = reservation_id #NEWLINE# result = weblab_api . api . send_command ( Command . Command ( 'get_html' ) ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# message = e . args [ 0 ] #NEWLINE# return ( HTML_TEMPLATE % { #NEWLINE# #INDENT# 'MESSAGE' : ( 'Failed to load LabVIEW experiment. Reason: %s. Call the administrator to fix it.' % message ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# resultstr = result . commandstring #NEWLINE# print ( ( '[DBG] Returning result from labview: ' + resultstr ) ) #NEWLINE# return ( HTML_TEMPLATE % { #NEWLINE# #INDENT# 'MESSAGE' : resultstr , #NEWLINE# #UNINDENT# } )