I got a strange problem with the WTForms library. For tests I created a form with a single field:
class ArticleForm(Form):content = TextField('Content')
It receives a simple string as content and now I use form.validate()
and it returns False
for any reason.
I looked into the validate()
methods of the 'Form
and Field
object. I found out that the field returns true if the length of the errorlist is zero. This is true for my test as i don't get any errors. In the shell the validation of my field returns True as expected.
The validate()
methode in the Form object just runs over the fields and calls their validate()
method and only returns false if one of the fields is validated as false.
So as my Field is validated without any error i can't see any reason in the code why form.validate()
returns False
.
Any ideas?