我无法验证烧瓶的wtf表格。
@app.route('/rss_feed',methods=['POST'])
def rss_feed():
form = rss_form(request.form)
from_year = int(request.form['from_year'])
to_year = int(request.form['to_year'])
res= ''
print(from_year)
if request.method == 'POST' and form.validate():
return jsonify({'test': request.form})
Traceback (most recent call last):
File "/home/prm/projects/environments/sec_download/lib/python3.5/site-packages/flask/app.py", line 2328, in __call__
return self.wsgi_app(environ, start_response)
File "/home/prm/projects/environments/sec_download/lib/python3.5/site-packages/flask/app.py", line 2314, in wsgi_app
response = self.handle_exception(e)
File "/home/prm/projects/environments/sec_download/lib/python3.5/site-packages/flask/app.py", line 1760, in handle_exception
reraise(exc_type, exc_value, tb)
File "/home/prm/projects/environments/sec_download/lib/python3.5/site-packages/flask/_compat.py", line 36, in reraise
raise value
File "/home/prm/projects/environments/sec_download/lib/python3.5/site-packages/flask/app.py", line 2311, in wsgi_app
response = self.full_dispatch_request()
File "/home/prm/projects/environments/sec_download/lib/python3.5/site-packages/flask/app.py", line 1834, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/prm/projects/environments/sec_download/lib/python3.5/site-packages/flask/app.py", line 1737, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/prm/projects/environments/sec_download/lib/python3.5/site-packages/flask/_compat.py", line 36, in reraise
raise value
File "/home/prm/projects/environments/sec_download/lib/python3.5/site-packages/flask/app.py", line 1832, in full_dispatch_request
rv = self.dispatch_request()
File "/home/prm/projects/environments/sec_download/lib/python3.5/site-packages/flask/app.py", line 1818, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/prm/projects/quantum-xbrl-processor/focusfi_ui.py", line 46, in rss_feed
if request.method == 'POST' and form.validate():
File "/home/prm/projects/environments/sec_download/lib/python3.5/site-packages/wtforms/form.py", line 310, in validate
return super(Form, self).validate(extra)
File "/home/prm/projects/environments/sec_download/lib/python3.5/site-packages/wtforms/form.py", line 152, in validate
if not field.validate(self, extra):
File "/home/prm/projects/environments/sec_download/lib/python3.5/site-packages/wtforms/fields/core.py", line 206, in validate
stop_validation = self._run_validation_chain(form, chain)
File "/home/prm/projects/environments/sec_download/lib/python3.5/site-packages/wtforms/fields/core.py", line 226, in _run_validation_chain
validator(form, self)
File "/home/prm/projects/environments/sec_download/lib/python3.5/site-packages/wtforms/validators.py", line 134, in __call__
if data is None or (self.min is not None and data < self.min) or \
TypeError: unorderable types: str() < int()
我希望一些JSON输出返回到我的浏览器中。仅当我包含form.validate片段时,才会出现该错误。在评论了该代码段后,代码似乎正在运行。