From b6779b59a5cd15803bdd44a879c9423c87669f57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=9D=E5=B7=9D?= Date: Mon, 11 Apr 2022 15:38:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=B7=A5=E5=85=B7bug?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Utils/ValidateUtil.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Utils/ValidateUtil.py b/Utils/ValidateUtil.py index 7a58e56..c7bd031 100644 --- a/Utils/ValidateUtil.py +++ b/Utils/ValidateUtil.py @@ -32,7 +32,7 @@ class ValidateAttr(object): def __init__(self, **kwargs): """""" self.kwargs = kwargs - self.error_info = kwargs['error_info'] if 'error_info' in kwargs else ('{}异常'.format(kwargs['mark']) if 'mark' in kwargs else ('{}异常'.format(self.__dict__['fields_map'][self.kwargs['field']]) if 'fields_map' in self.__dict__ else None)) + self.error_info = kwargs['error_info'] if 'error_info' in kwargs else ('{}异常'.format(kwargs['mark']) if 'mark' in kwargs else None) self.error_code = kwargs['error_code'] if 'error_code' in kwargs else 200 def __get__(self, instance, owner): @@ -42,6 +42,8 @@ class ValidateAttr(object): def __set__(self, instance, value): """""" + self.error_info = '{}异常'.format(instance.fields_map[self.kwargs['field']]) + def not_default(): """无默认值时属性设值检查"""