def search():
q = request.args.get('q')
if not q:
q=''
f = request.args.get('f')
try:
p = int(request.args.get('p'))
except:
p = 0
try:
fmt=request.args.get('f')
print(fmt)
except:
fmt=""
count,context = nweb.search(q,100,100*int(str(p)))
# what kind of output are we looking for?
if fmt == 'hostlist':
print("printing hostlist because "+fmt)
return render_template("hostlist.html",query=q, numresults=count, page=p, hosts=context)
# default output (a pretty webpage)
return render_template("search2.html",query=q, numresults=count, page=p, hosts=context)
评论列表
文章目录