Skip to content

Commit

Permalink
bugfix: 修复api创建任务时,表格使用默认值导致渲染失败的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
hanshuaikang authored and normal-wls committed Dec 4, 2023
1 parent 6f87d09 commit 61fc734
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pipeline_plugins/variables/collections/datatable.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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:
Expand Down

0 comments on commit 61fc734

Please sign in to comment.