Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: 修复api创建任务时,表格使用默认值导致渲染失败的问题 #7169

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading