return (headerlist,htmlcontent) def application(env,start_response): if env['PATH_INFO'].find('handle') > 0: try: querys = querystrtomap(env['QUERY_STRING']) header = gethandleheader(querys['k']) write = start_response('302 Found',header) write('test') except Exception,e: doerror(start_response) return elif env['PATH_INFO'].find('sumary')>0: querys = querystrtomap(env['QUERY_STRING']) content = getsumary(querys['k']) resulthtml = parsehtml2.getsumary(content) write = start_response('200 OK',[('Content-Length',str(len(resulthtml)))]) write(resulthtml) #这里是结果首页 elif env['PATH_INFO'].find('search') > 0 and env['QUERY_STRING'].find('p=')<0: try: querys = querystrtomap(env['QUERY_STRING']) cookiestr = env['HTTP_COOKIE'] headerlist,htmlcontent = getsearchcontent('java',getdecodecookiestr(cookiestr)) except Exception,e: doerror(start_response) return resulthtml = parsehtml2.makeresulthtml(htmlcontent,querys['k']) # contentlist = parsehtml2.makecontentlist(htmlcontent) # jsonstr = json.dumps(contentlist) # contentstr = ''
def summary(info): content = handle2.getsumary(info) resulthtml = parsehtml2.getsumary(content) resp = make_response(resulthtml) return resp