为什么ClientForm(data = data)断点不是条目类ClitenForm(Form)?

时间:2019-05-04 10:02:53

标签: flask

设置断点测试时,我单击“跳过”,代码不输入下一个断点?我不知道为什么?

这是第一个入口断点,现在type的形式是int:

断点一:

create_client(): form = ClientForm(data=data)

然后跨步,进入断点两个,现在形式type来自int转换枚举:

class ClientForm(): client = ClientTypeEnum(value.data)

breakpoint img

flask1.0

pycharm2018

client.py:

from app.validators.forms import ClientForm

create_client():
    data = request.json
    form = ClientForm(data=data)
    if form.validate():
        promise = {
            ClientTypeEnum.USER_EMAIL: _register_by_user_email
        }
        promise[form.type.data]()
    return 'success'

forms.py:

from app.libs.enums import ClientTypeEnum

class ClientForm(Form):
    ...
    type = IntegerField(validators=[DataRequired()])

    def validator_type(self, value):
        client = ClientTypeEnum(value.data)
    self.type.data = client

enums.py:

class ClientTypeEnum(Enum):
    USER_EMAIL = 100

我希望断点输入form=ClientForm(data=data)越过断点输入class ClientForm

0 个答案:

没有答案