查了一下这个报错,都说是因为有return返回了None,但是我检查了一下还是没有找到漏洞,请帮忙看一下!
# 读取表单数据,获得doc_ID
@app.route('/search/', methods=['POST'])
def search():
try:
global keys
global checked
checked = ['checked="true"', '', '']
keys = request.form['key_word']
#print(keys)
if keys not in ['']:
start_time = time.clock()
flag,page = searchidlist(keys)
if flag==0: # 代表无结果,返回查询无结果的页面
return render_template('search.html', error=False, hot_news=False)
docs = cut_page(page, 0)
end_time = time.clock()
time_used = round((end_time - start_time),3)
return render_template('high_search.html', checked=checked, key=keys, docs=docs, page=page,
error=True, hot_news=False, time_used=time_used)
else:
return render_template('search.html', error=False, hot_news=False)
except:
print('search error')