From 21b206e0e8b33e6a587100c1a30b91116f868130 Mon Sep 17 00:00:00 2001 From: guohelu <19503896967@163.com> Date: Tue, 19 Nov 2024 14:47:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=8D=8F=E8=AE=AE=E9=97=AE=E9=A2=98=20#7603?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gcloud/apigw/views/get_template_list.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gcloud/apigw/views/get_template_list.py b/gcloud/apigw/views/get_template_list.py index 6acb17ac8..6bbfe94e0 100644 --- a/gcloud/apigw/views/get_template_list.py +++ b/gcloud/apigw/views/get_template_list.py @@ -87,8 +87,9 @@ def get_template_list(request, project_id): if allowed: template_info["auth_actions"].append(action) - templates_labels = TemplateLabelRelation.objects.fetch_templates_labels(template_id_list) - for obj in template_list: - obj["template_labels"] = templates_labels.get(obj["id"], []) + if label_names: + templates_labels = TemplateLabelRelation.objects.fetch_templates_labels(template_id_list) + for obj in template_list: + obj["template_labels"] = templates_labels.get(obj["id"], []) return {"result": True, "data": template_list, "code": err_code.SUCCESS.code}