#NEWLINE# def handle_interactive_request( self , environ ) : #NEWLINE# #INDENT# code = environ [ 'wsgi.input' ] . read ( ) . replace ( '\r\n' , '\n' ) #NEWLINE# user_environ = self . get_user_environ ( environ ) #NEWLINE# if ( 'HTTP_CONTENT_LENGTH' in user_environ ) : #NEWLINE# #INDENT# del user_environ [ 'HTTP_CONTENT_LENGTH' ] #NEWLINE# #UNINDENT# user_environ [ 'REQUEST_METHOD' ] = 'GET' #NEWLINE# url = ( 'http://%s:%s%s?%s' % ( user_environ [ 'SERVER_NAME' ] , user_environ [ 'SERVER_PORT' ] , urllib . quote ( environ [ 'PATH_INFO' ] ) , environ [ 'QUERY_STRING' ] ) ) #NEWLINE# results_io = cStringIO . StringIO ( ) #NEWLINE# old_sys_stdout = sys . stdout #NEWLINE# try : #NEWLINE# #INDENT# error = logservice . LogsBuffer ( ) #NEWLINE# request_environment . current_request . Init ( error , user_environ ) #NEWLINE# url = urlparse . urlsplit ( url ) #NEWLINE# environ . update ( runtime . CgiDictFromParsedUrl ( url ) ) #NEWLINE# sys . stdout = results_io #NEWLINE# try : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# __import__ ( 'appengine_config' , self . _command_globals ) #NEWLINE# #UNINDENT# except ImportError as e : #NEWLINE# #INDENT# if ( 'appengine_config' not in e . message ) : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# #UNINDENT# compiled_code = compile ( code , '<string>' , 'exec' ) #NEWLINE# exec ( compiled_code , self . _command_globals ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# traceback . print_exc ( file = results_io ) #NEWLINE# #UNINDENT# return { #NEWLINE# #INDENT# 'error' : 0 , #NEWLINE# 'response_code' : 200 , #NEWLINE# 'headers' : [ ( 'Content-Type' , 'text/plain' ) ] , #NEWLINE# 'body' : results_io . getvalue ( ) , #NEWLINE# 'logs' : error . parse_logs ( ) , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# request_environment . current_request . Clear ( ) #NEWLINE# sys . stdout = old_sys_stdout