For some reason WTForms is getting information in unicode format instead of the normal format. The code used to work than when it got restarted it broke.
The error in flask view:
TypeError
TypeError: 'unicode' object is not callable
The error in console:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/flask/app.py", line 1836, in call
return self.wsgi_app(environ, start_response)
File "/Library/Python/2.7/site-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/Library/Python/2.7/site-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/Library/Python/2.7/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/Library/Python/2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Library/Python/2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/Library/Python/2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/Library/Python/2.7/site-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functionsrule.endpoint
File "/Users/marcellobachechi/Desktop/RMP/server.py", line 72, in hello
user = form.song.data()
TypeError: 'unicode' object is not callable
The code is:
class PickASong(Form):
song = TextField(u'Song title', validators=[DataRequired()])
form = PickASong(csrf_enabled=False)
if form.validate_on_submit():
user = form.song.data()
The HTML:
<form action="" method="post" name="login">
<p>
{{ form.song(size=20) }}
<input type="submit" value="Search!"></p></p>
{{ form.song(size=20) }}
</form>