def BuildCGIRequest(base_env_dict, request, dev_appserver):
 if (request.headers is None):
  request.headers = {}
 request.headers['Content-Type'] = 'application/json'
 url = (SPI_ROOT_FORMAT % (request.port, request.path))
 base_env_dict['REQUEST_METHOD'] = 'POST'
 header_outfile = cStringIO.StringIO()
 body_outfile = cStringIO.StringIO()
 WriteHeaders(request.headers, header_outfile, len(request.body))
 body_outfile.write(request.body)
 header_outfile.seek(0)
 body_outfile.seek(0)
 return dev_appserver.AppServerRequest(url, None, mimetools.Message(header_outfile), body_outfile)

def BuildCGIRequest ( base_env_dict , request , dev_appserver ) : if ( request . headers is None ) : request . headers = { } request . headers [ 'Content-Type' ] = 'application/json' url = ( SPI_ROOT_FORMAT % ( request . port , request . path ) ) base_env_dict [ 'REQUEST_METHOD' ] = 'POST' header_outfile = cStringIO . StringIO ( ) body_outfile = cStringIO . StringIO ( ) WriteHeaders ( request . headers , header_outfile , len ( request . body ) ) body_outfile . write ( request . body ) header_outfile . seek ( 0 ) body_outfile . seek ( 0 ) return dev_appserver . AppServerRequest ( url , None , mimetools . Message ( header_outfile ) , body_outfile )
build a cgi request to call a method on an spi backend .