Skip to content

Commit

Permalink
fix: django4.2替换url()为path()、re_patch() TencentBlueKing#7625
Browse files Browse the repository at this point in the history
  • Loading branch information
huangpixu committed Dec 9, 2024
1 parent 3697bde commit 348976e
Show file tree
Hide file tree
Showing 36 changed files with 369 additions and 375 deletions.
59 changes: 29 additions & 30 deletions config/urls_custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,36 @@
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.
"""
from rest_framework import permissions
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
from django.conf.urls import include, url
from django.conf import settings

from django.urls import include, re_path
from drf_yasg import openapi
from drf_yasg.views import get_schema_view
from rest_framework import permissions

# 用户自定义 urlconf
urlpatterns_custom = [
url(r"^", include("gcloud.core.urls")),
url(r"^", include("gcloud.resources.urls")),
url(r"^apigw/", include("gcloud.apigw.urls")),
url(r"^common_template/", include("gcloud.common_template.urls")),
url(r"^template/", include("gcloud.tasktmpl3.urls")),
url(r"^template/", include("gcloud.template_base.urls")),
url(r"^taskflow/", include("gcloud.taskflow3.urls")),
url(r"^appmaker/", include("gcloud.contrib.appmaker.urls")),
url(r"^collection/", include("gcloud.contrib.collection.urls")),
url(r"^develop/", include("gcloud.contrib.develop.urls")),
url(r"^function/", include("gcloud.contrib.function.urls")),
url(r"^pipeline/", include("pipeline_plugins.base.urls")),
url(r"^pipeline/", include("pipeline_plugins.components.urls")),
url(r"^pipeline/", include("pipeline_plugins.variables.urls")),
url(r"^analysis/", include("gcloud.contrib.analysis.urls")),
url(r"^periodictask/", include("gcloud.periodictask.urls")),
url(r"^weixin/", include("weixin.urls")),
url(r"^weixin/login/", include("weixin.core.urls")),
url(r"^admin/", include("gcloud.contrib.admin.urls")),
url(r"^plugin_service/", include("plugin_service.urls")),
url(r"^mako_operations/", include("gcloud.mako_template_helper.urls")),
url(r"^engine_admin/", include("pipeline.contrib.engine_admin.urls")),
re_path(r"^", include("gcloud.core.urls")),
re_path(r"^", include("gcloud.resources.urls")),
re_path(r"^apigw/", include("gcloud.apigw.urls")),
re_path(r"^common_template/", include("gcloud.common_template.urls")),
re_path(r"^template/", include("gcloud.tasktmpl3.urls")),
re_path(r"^template/", include("gcloud.template_base.urls")),
re_path(r"^taskflow/", include("gcloud.taskflow3.urls")),
re_path(r"^appmaker/", include("gcloud.contrib.appmaker.urls")),
re_path(r"^collection/", include("gcloud.contrib.collection.urls")),
re_path(r"^develop/", include("gcloud.contrib.develop.urls")),
re_path(r"^function/", include("gcloud.contrib.function.urls")),
re_path(r"^pipeline/", include("pipeline_plugins.base.urls")),
re_path(r"^pipeline/", include("pipeline_plugins.components.urls")),
re_path(r"^pipeline/", include("pipeline_plugins.variables.urls")),
re_path(r"^analysis/", include("gcloud.contrib.analysis.urls")),
re_path(r"^periodictask/", include("gcloud.periodictask.urls")),
re_path(r"^weixin/", include("weixin.urls")),
re_path(r"^weixin/login/", include("weixin.core.urls")),
re_path(r"^admin/", include("gcloud.contrib.admin.urls")),
re_path(r"^plugin_service/", include("plugin_service.urls")),
re_path(r"^mako_operations/", include("gcloud.mako_template_helper.urls")),
re_path(r"^engine_admin/", include("pipeline.contrib.engine_admin.urls")),
]

schema_view = get_schema_view(
Expand All @@ -56,7 +55,7 @@

if settings.ENVIRONMENT != "production" or settings.ENABLE_SWAGGER_UI:
urlpatterns_custom += [
url(r"^swagger(?P<format>\.json|\.yaml)$", schema_view.without_ui(cache_timeout=0), name="schema-json"),
url(r"^swagger/$", schema_view.with_ui("swagger", cache_timeout=0), name="schema-swagger-ui"),
url(r"^redoc/$", schema_view.with_ui("redoc", cache_timeout=0), name="schema-redoc"),
re_path(r"^swagger(?P<format>\.json|\.yaml)$", schema_view.without_ui(cache_timeout=0), name="schema-json"),
re_path(r"^swagger/$", schema_view.with_ui("swagger", cache_timeout=0), name="schema-swagger-ui"),
re_path(r"^redoc/$", schema_view.with_ui("redoc", cache_timeout=0), name="schema-redoc"),
]
86 changes: 43 additions & 43 deletions gcloud/apigw/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
specific language governing permissions and limitations under the License.
"""

from django.conf.urls import url
from django.urls import re_path

from gcloud.apigw.views.claim_functionalization_task import claim_functionalization_task
from gcloud.apigw.views.create_and_start_task import create_and_start_task
Expand Down Expand Up @@ -57,76 +57,76 @@
from gcloud.apigw.views.start_task import start_task

urlpatterns = [
url(r"^dispatch_plugin_query/$", dispatch_plugin_query),
url(r"^get_template_list/(?P<project_id>\d+)/$", get_template_list),
url(
re_path(r"^dispatch_plugin_query/$", dispatch_plugin_query),
re_path(r"^get_template_list/(?P<project_id>\d+)/$", get_template_list),
re_path(
r"^get_template_info/(?P<template_id>\d+)/(?P<project_id>\d+)/$",
get_template_info,
),
url(r"^get_common_template_list/$", get_common_template_list),
url(r"^get_common_template_info/(?P<template_id>\d+)/$", get_common_template_info),
url(r"^create_task/(?P<template_id>\d+)/(?P<project_id>\d+)/$", create_task),
url(r"^fast_create_task/(?P<project_id>\d+)/$", fast_create_task),
url(r"^start_task/(?P<task_id>\d+)/(?P<project_id>\d+)/$", start_task),
url(r"^operate_task/(?P<task_id>\d+)/(?P<project_id>\d+)/$", operate_task),
url(r"^get_task_status/(?P<task_id>\d+)/(?P<project_id>\d+)/$", get_task_status),
url(r"^query_task_count/(?P<project_id>\d+)/$", query_task_count),
url(r"^get_periodic_task_list/(?P<project_id>\d+)/$", get_periodic_task_list),
url(
re_path(r"^get_common_template_list/$", get_common_template_list),
re_path(r"^get_common_template_info/(?P<template_id>\d+)/$", get_common_template_info),
re_path(r"^create_task/(?P<template_id>\d+)/(?P<project_id>\d+)/$", create_task),
re_path(r"^fast_create_task/(?P<project_id>\d+)/$", fast_create_task),
re_path(r"^start_task/(?P<task_id>\d+)/(?P<project_id>\d+)/$", start_task),
re_path(r"^operate_task/(?P<task_id>\d+)/(?P<project_id>\d+)/$", operate_task),
re_path(r"^get_task_status/(?P<task_id>\d+)/(?P<project_id>\d+)/$", get_task_status),
re_path(r"^query_task_count/(?P<project_id>\d+)/$", query_task_count),
re_path(r"^get_periodic_task_list/(?P<project_id>\d+)/$", get_periodic_task_list),
re_path(
r"^get_periodic_task_info/(?P<task_id>\d+)/(?P<project_id>\d+)/$",
get_periodic_task_info,
),
url(
re_path(
r"^create_periodic_task/(?P<template_id>\d+)/(?P<project_id>\d+)/$",
create_periodic_task,
),
url(
re_path(
r"^set_periodic_task_enabled/(?P<task_id>\d+)/(?P<project_id>\d+)/$",
set_periodic_task_enabled,
),
url(
re_path(
r"^modify_cron_for_periodic_task/(?P<task_id>\d+)/(?P<project_id>\d+)/$",
modify_cron_for_periodic_task,
),
url(r"^modify_constants_for_task/(?P<task_id>\d+)/(?P<project_id>\d+)/$", modify_constants_for_task),
url(
re_path(r"^modify_constants_for_task/(?P<task_id>\d+)/(?P<project_id>\d+)/$", modify_constants_for_task),
re_path(
r"^modify_constants_for_periodic_task/(?P<task_id>\d+)/(?P<project_id>\d+)/$",
modify_constants_for_periodic_task,
),
url(r"^get_task_list/(?P<project_id>\d+)/$", get_task_list),
url(r"^get_task_detail/(?P<task_id>\d+)/(?P<project_id>\d+)/$", get_task_detail),
url(
re_path(r"^get_task_list/(?P<project_id>\d+)/$", get_task_list),
re_path(r"^get_task_detail/(?P<task_id>\d+)/(?P<project_id>\d+)/$", get_task_detail),
re_path(
r"^get_task_node_detail/(?P<task_id>\d+)/(?P<project_id>\d+)/$",
get_task_node_detail,
),
url(r"^node_callback/(?P<task_id>\d+)/(?P<project_id>\d+)/$", node_callback),
url(r"^import_common_template/$", import_common_template),
url(r"^get_plugin_list/(?P<project_id>\d+)/$", get_plugin_list),
url(r"^get_plugin_detail/(?P<project_id>\d+)/$", get_plugin_detail),
url(r"^get_user_project_list/$", get_user_project_list),
url(r"^get_user_project_detail/(?P<project_id>\d+)/$", get_user_project_detail),
url(
re_path(r"^node_callback/(?P<task_id>\d+)/(?P<project_id>\d+)/$", node_callback),
re_path(r"^import_common_template/$", import_common_template),
re_path(r"^get_plugin_list/(?P<project_id>\d+)/$", get_plugin_list),
re_path(r"^get_plugin_detail/(?P<project_id>\d+)/$", get_plugin_detail),
re_path(r"^get_user_project_list/$", get_user_project_list),
re_path(r"^get_user_project_detail/(?P<project_id>\d+)/$", get_user_project_detail),
re_path(
r"^get_template_schemes/(?P<project_id>\d+)/(?P<template_id>\d+)/$",
get_template_schemes,
),
url(
re_path(
r"^preview_task_tree/(?P<project_id>\d+)/(?P<template_id>\d+)/$",
preview_task_tree,
),
url(
re_path(
r"^get_task_node_data/(?P<project_id>\d+)/(?P<task_id>\d+)/$",
get_task_node_data,
),
url(r"^operate_node/(?P<project_id>\d+)/(?P<task_id>\d+)/$", operate_node),
url(r"^get_tasks_status/(?P<project_id>\d+)/$", get_tasks_status),
url(r"^get_tasks_manual_intervention_state/(?P<project_id>\d+)/$", get_tasks_manual_intervention_state),
url(r"^import_project_template/(?P<project_id>\d+)/$", import_project_template),
url(r"^claim_functionalization_task/(?P<task_id>\d+)/(?P<project_id>\d+)/$", claim_functionalization_task),
url(r"^get_functionalization_task_list/$", get_functionalization_task_list),
url(r"^preview_common_task_tree/(?P<project_id>\d+)/(?P<template_id>\d+)/$", preview_common_task_tree),
url(r"^register_project/$", register_project),
url(r"^create_and_start_task/(?P<template_id>\d+)/(?P<project_id>\d+)/$", create_and_start_task),
url(r"^create_clocked_task/(?P<template_id>\d+)/(?P<project_id>\d+)/$", create_clocked_task),
url(r"^get_mini_app_list/(?P<project_id>\d+)/$", get_mini_app_list),
url(r"^get_task_count/(?P<project_id>\d+)/$", get_task_count),
re_path(r"^operate_node/(?P<project_id>\d+)/(?P<task_id>\d+)/$", operate_node),
re_path(r"^get_tasks_status/(?P<project_id>\d+)/$", get_tasks_status),
re_path(r"^get_tasks_manual_intervention_state/(?P<project_id>\d+)/$", get_tasks_manual_intervention_state),
re_path(r"^import_project_template/(?P<project_id>\d+)/$", import_project_template),
re_path(r"^claim_functionalization_task/(?P<task_id>\d+)/(?P<project_id>\d+)/$", claim_functionalization_task),
re_path(r"^get_functionalization_task_list/$", get_functionalization_task_list),
re_path(r"^preview_common_task_tree/(?P<project_id>\d+)/(?P<template_id>\d+)/$", preview_common_task_tree),
re_path(r"^register_project/$", register_project),
re_path(r"^create_and_start_task/(?P<template_id>\d+)/(?P<project_id>\d+)/$", create_and_start_task),
re_path(r"^create_clocked_task/(?P<template_id>\d+)/(?P<project_id>\d+)/$", create_clocked_task),
re_path(r"^get_mini_app_list/(?P<project_id>\d+)/$", get_mini_app_list),
re_path(r"^get_task_count/(?P<project_id>\d+)/$", get_task_count),
]
6 changes: 3 additions & 3 deletions gcloud/auto_test/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +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.
"""
from django.conf.urls import include, url
from django.urls import include, re_path
from rest_framework.routers import DefaultRouter

from gcloud.auto_test.apis.viewsets.template import ProjectTemplateViewSet, CommonTemplateViewSet
from gcloud.auto_test.apis.viewsets.periodic_task import PeriodicTaskViewSet
from gcloud.auto_test.apis.viewsets.template import CommonTemplateViewSet, ProjectTemplateViewSet
from gcloud.auto_test.apis.viewsets.token import AutoTestTokenViewSet

auto_test_router = DefaultRouter()
Expand All @@ -24,5 +24,5 @@
auto_test_router.register(r"get_token", AutoTestTokenViewSet, basename="get_token")

urlpatterns = [
url(r"^", include(auto_test_router.urls)),
re_path(r"^", include(auto_test_router.urls)),
]
15 changes: 7 additions & 8 deletions gcloud/common_template/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@
specific language governing permissions and limitations under the License.
"""

from django.conf.urls import url
from django.urls import re_path

from gcloud.common_template.apis.django import api


urlpatterns = [
url(r"^api/form/$", api.form),
url(r"^api/batch_form/$", api.batch_form),
url(r"^api/export/$", api.export_templates),
url(r"^api/import/$", api.import_templates),
url(r"^api/import_check/$", api.check_before_import),
url(r"^api/parents/$", api.parents),
re_path(r"^api/form/$", api.form),
re_path(r"^api/batch_form/$", api.batch_form),
re_path(r"^api/export/$", api.export_templates),
re_path(r"^api/import/$", api.import_templates),
re_path(r"^api/import_check/$", api.check_before_import),
re_path(r"^api/parents/$", api.parents),
]
48 changes: 24 additions & 24 deletions gcloud/contrib/admin/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
specific language governing permissions and limitations under the License.
"""

from django.conf.urls import include, url
from django.urls import include, re_path
from rest_framework.routers import DefaultRouter

from gcloud.contrib.admin import migration_api, views
Expand All @@ -35,27 +35,27 @@


urlpatterns = [
url(r"^api/v3/", include(v3_drf_api.urls)),
url(r"^template/restore", views.restore_template),
url(r"^template/refresh_template_notify_type/$", views.refresh_template_notify_type),
url(r"^template/make_template_notify_type_loadable/$", views.make_template_notify_type_loadable),
url(r"^taskflow/upsert_context", views.upsert_taskflow_v2_context),
url(r"^taskflow/detail", views.get_taskflow_v1_detail),
url(r"^taskflow/node/detail", views.get_taskflow_v1_node_detail),
url(r"^taskflow/node/history/log", views.get_node_v1_history_log),
url(r"^search", views.search),
url(r"^command/get_cache_key/(?P<key>\w+)/$", views.get_cache_key),
url(r"^command/delete_cache_key/(?P<key>\w+)/$", views.delete_cache_key),
url(r"^command/get_settings/$", views.get_settings),
url(r"^command/upsert_iam_system_provider_config/$", views.upsert_iam_system_provider_config),
url(r"^command/migrate_pipeline_parent_data/$", views.migrate_pipeline_parent_data),
url(r"^migration/register_resource_config/$", migration_api.register_resource_config),
url(r"^migration/migrate_app_maker/$", migration_api.migrate_app_maker),
url(r"^migration/migrate_staff_group/$", migration_api.migrate_staff_group),
url(r"^migration/migrate_template_category/$", migration_api.migrate_template_category),
url(r"^migration/fix_engine_version_zero_task/$", migration_api.fix_engine_version_zero_task),
url(r"^batch_insert_project_based_component/$", batch_insert_project_based_component),
url(r"^batch_delete_project_based_component/$", batch_delete_project_based_component),
url(r"^batch_revoke_task/$", batch_revoke_task),
url(r"^command/get_enabled_periodic_task/$", views.get_enabled_periodic_task),
re_path(r"^api/v3/", include(v3_drf_api.urls)),
re_path(r"^template/restore", views.restore_template),
re_path(r"^template/refresh_template_notify_type/$", views.refresh_template_notify_type),
re_path(r"^template/make_template_notify_type_loadable/$", views.make_template_notify_type_loadable),
re_path(r"^taskflow/upsert_context", views.upsert_taskflow_v2_context),
re_path(r"^taskflow/detail", views.get_taskflow_v1_detail),
re_path(r"^taskflow/node/detail", views.get_taskflow_v1_node_detail),
re_path(r"^taskflow/node/history/log", views.get_node_v1_history_log),
re_path(r"^search", views.search),
re_path(r"^command/get_cache_key/(?P<key>\w+)/$", views.get_cache_key),
re_path(r"^command/delete_cache_key/(?P<key>\w+)/$", views.delete_cache_key),
re_path(r"^command/get_settings/$", views.get_settings),
re_path(r"^command/upsert_iam_system_provider_config/$", views.upsert_iam_system_provider_config),
re_path(r"^command/migrate_pipeline_parent_data/$", views.migrate_pipeline_parent_data),
re_path(r"^migration/register_resource_config/$", migration_api.register_resource_config),
re_path(r"^migration/migrate_app_maker/$", migration_api.migrate_app_maker),
re_path(r"^migration/migrate_staff_group/$", migration_api.migrate_staff_group),
re_path(r"^migration/migrate_template_category/$", migration_api.migrate_template_category),
re_path(r"^migration/fix_engine_version_zero_task/$", migration_api.fix_engine_version_zero_task),
re_path(r"^batch_insert_project_based_component/$", batch_insert_project_based_component),
re_path(r"^batch_delete_project_based_component/$", batch_delete_project_based_component),
re_path(r"^batch_revoke_task/$", batch_revoke_task),
re_path(r"^command/get_enabled_periodic_task/$", views.get_enabled_periodic_task),
]
25 changes: 13 additions & 12 deletions gcloud/contrib/analysis/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,20 @@
specific language governing permissions and limitations under the License.
"""

from django.conf.urls import url
from django.urls import path, re_path

from gcloud.contrib.analysis import views

urlpatterns = [
url(r"^query_instance_by_group/$", views.query_instance_by_group),
url(r"^query_template_by_group/$", views.query_template_by_group),
url(r"^query_atom_by_group/$", views.query_atom_by_group),
url(r"^query_appmaker_by_group/$", views.query_appmaker_by_group),
url(r"^template/$", views.analysis_home),
url(r"^instance/$", views.analysis_home),
url(r"^appmaker/$", views.analysis_home),
url(r"^atom/$", views.analysis_home),
url(r"^get_task_category/$", views.get_task_category),
url(r"^get_biz_useage/(?P<query>\w+)/$", views.get_biz_useage),
url(r"get_component_list/", views.get_component_list),
re_path(r"^query_instance_by_group/$", views.query_instance_by_group),
re_path(r"^query_template_by_group/$", views.query_template_by_group),
re_path(r"^query_atom_by_group/$", views.query_atom_by_group),
re_path(r"^query_appmaker_by_group/$", views.query_appmaker_by_group),
re_path(r"^template/$", views.analysis_home),
re_path(r"^instance/$", views.analysis_home),
re_path(r"^appmaker/$", views.analysis_home),
re_path(r"^atom/$", views.analysis_home),
re_path(r"^get_task_category/$", views.get_task_category),
re_path(r"^get_biz_useage/(?P<query>\w+)/$", views.get_biz_useage),
path(r"get_component_list/", views.get_component_list),
]
18 changes: 8 additions & 10 deletions gcloud/contrib/appmaker/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,20 @@
specific language governing permissions and limitations under the License.
"""

from django.conf.urls import url
from django.urls import re_path

from gcloud.contrib.appmaker import views, api
from gcloud.contrib.appmaker import api, views

urlpatterns = [
# 新建、编辑轻应用
url(r'^save/(?P<project_id>\d+)/$', api.save),

re_path(r"^save/(?P<project_id>\d+)/$", api.save),
# mini-app 内链接

# 打开一个轻应用,直接进入参数填写阶段
url(r'^(?P<app_id>\d+)/newtask/(?P<project_id>\d+)/selectnode/$', views.newtask_selectnode),
url(r'^(?P<app_id>\d+)/newtask/(?P<project_id>\d+)/paramfill/$', views.newtask_paramfill),
re_path(r"^(?P<app_id>\d+)/newtask/(?P<project_id>\d+)/selectnode/$", views.newtask_selectnode),
re_path(r"^(?P<app_id>\d+)/newtask/(?P<project_id>\d+)/paramfill/$", views.newtask_paramfill),
# 从轻应用的任务记录跳转到任务详情
url(r'^(?P<app_id>\d+)/execute/(?P<project_id>\d+)/$', views.execute),
re_path(r"^(?P<app_id>\d+)/execute/(?P<project_id>\d+)/$", views.execute),
# 轻应用中任务列表
url(r'^(?P<app_id>\d+)/task_home/(?P<project_id>\d+)/$', views.task_home),
url(r'^get_appmaker_count/(?P<project_id>\d+)/$', api.get_appmaker_count),
re_path(r"^(?P<app_id>\d+)/task_home/(?P<project_id>\d+)/$", views.task_home),
re_path(r"^get_appmaker_count/(?P<project_id>\d+)/$", api.get_appmaker_count),
]
Loading

0 comments on commit 348976e

Please sign in to comment.