python flask : TypeError: __call__() takes exactly 3 arguments (2 given)

python flask : TypeError: __call__() takes exactly 3 arguments (2 given)

我的代码中有一个关于 python 使用 framework flask 的问题。我不知道我的代码有什么错误。也许是我在 wtforms 区域的错误。请帮助我

这是我的错误 enter image description here

我的文件:setpassword.py

from flask import render_template, Blueprint, request, redirect, url_for, abort, flash, current_app
from urlparse import urlparse, urljoin
from forms import SetpasswordForm
from flask_login import login_user, logout_user, login_required, current_user
from models import Partner, User, mail, db
from flask_mail import Message
import uuid

setpassword_blueprint = Blueprint('setpassword', __name__)


@setpassword_blueprint.route('/', methods=['GET', 'POST'])
def setpassword():
    form = SetpasswordForm()
    if form.validate_on_submit():
        print "halo"
    return render_template('forms/setpassword.html', form=form)

setpassword_form.py

from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField
from wtforms.validators import DataRequired, Length, Email, EqualTo


class SetpasswordForm(FlaskForm):
     password = StringField('Password', [Length(min=6, max=20, message='Password minimal 6 karakter dan maksimal 20 karakter.')], [DataRequired()])
     confirm_password = StringField('Confirm Password', [EqualTo('password', message='Password dan Confirm password tidak sama.')], [DataRequired()])

def __init__(self, *args, **kwargs):
    FlaskForm.__init__(self, *args, **kwargs)

来自文档 - https://wtforms.readthedocs.io/en/2.3.x/fields/#field-definitions,在初始化表单元素时,应在单个列表中传递验证器,而不是用逗号分隔的多个列表。

password = StringField('Password', 
                     [Length(min=6, max=20, message='Password minimal 6 karakter dan maksimal 20 karakter.'),
                     DataRequired()]
)