From 61fc734ea8a5287944b6fc0a42d5352c0627a4b2 Mon Sep 17 00:00:00 2001 From: hanshuaikang <1758504262@qq.com> Date: Wed, 15 Nov 2023 17:13:42 +0800 Subject: [PATCH] =?UTF-8?q?bugfix:=20=E4=BF=AE=E5=A4=8Dapi=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E4=BB=BB=E5=8A=A1=E6=97=B6=EF=BC=8C=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E9=BB=98=E8=AE=A4=E5=80=BC=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E6=B8=B2=E6=9F=93=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pipeline_plugins/variables/collections/datatable.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pipeline_plugins/variables/collections/datatable.py b/pipeline_plugins/variables/collections/datatable.py index 84a9eb09f1..c68c7a9a11 100644 --- a/pipeline_plugins/variables/collections/datatable.py +++ b/pipeline_plugins/variables/collections/datatable.py @@ -10,12 +10,11 @@ an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ - +import json import logging from django.conf import settings from django.utils.translation import ugettext_lazy as _ - from pipeline.core.data.var import LazyVariable from pipeline.core.flow.io import StringItemSchema @@ -24,6 +23,14 @@ class DataTableValue(object): def __init__(self, data): + try: + # data 为 字符串的情况下表示可能使用了默认值, + # 尝试序列化,不然下面也会报错 + if isinstance(data, str): + data = json.loads(data) + except Exception as e: + logger.exception("[datatable] value error, value = {}, error={}".format(data, e)) + self._value = data item_values = {} for item in data: