From 348976e23f5d1cea2e138896bf8935df0d333f7d Mon Sep 17 00:00:00 2001 From: huangpixu Date: Mon, 9 Dec 2024 16:10:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20django4.2=E6=9B=BF=E6=8D=A2url()?= =?UTF-8?q?=E4=B8=BApath()=E3=80=81re=5Fpatch()=20#7625?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/urls_custom.py | 59 +++++++------ gcloud/apigw/urls.py | 86 +++++++++---------- gcloud/auto_test/urls.py | 6 +- gcloud/common_template/urls.py | 15 ++-- gcloud/contrib/admin/urls.py | 48 +++++------ gcloud/contrib/analysis/urls.py | 25 +++--- gcloud/contrib/appmaker/urls.py | 18 ++-- gcloud/contrib/collection/urls.py | 6 +- gcloud/contrib/develop/urls.py | 8 +- gcloud/contrib/function/urls.py | 6 +- gcloud/core/urls.py | 34 ++++---- gcloud/iam_auth/urls.py | 10 +-- gcloud/mako_template_helper/urls.py | 4 +- gcloud/periodictask/urls.py | 8 +- gcloud/resources/urls.py | 30 +++---- gcloud/taskflow3/apis/django/v4/urls.py | 8 +- gcloud/taskflow3/urls.py | 37 ++++---- gcloud/tasktmpl3/urls.py | 38 ++++---- gcloud/template_base/urls.py | 11 ++- pipeline_plugins/base/urls.py | 7 +- pipeline_plugins/cmdb_ip_picker/urls.py | 8 +- .../components/query/sites/open/cc.py | 69 ++++++++------- .../query/sites/open/file_upload.py | 19 ++-- .../components/query/sites/open/gsekit.py | 4 +- .../components/query/sites/open/itsm.py | 6 +- .../components/query/sites/open/job.py | 49 +++++++---- .../components/query/sites/open/monitor.py | 9 +- .../components/query/sites/open/nodeman.py | 14 +-- .../variables/query/sites/open/query.py | 25 +++--- .../variables/query/sites/open/select.py | 6 +- plugin_service/README.md | 2 +- plugin_service/docs/openapi_config.md | 6 +- plugin_service/urls.py | 19 ++-- urls.py | 14 +-- weixin/core/urls.py | 5 +- weixin/urls.py | 25 +++--- 36 files changed, 369 insertions(+), 375 deletions(-) diff --git a/config/urls_custom.py b/config/urls_custom.py index 6ed3c5ecef..590eb80eec 100644 --- a/config/urls_custom.py +++ b/config/urls_custom.py @@ -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( @@ -56,7 +55,7 @@ if settings.ENVIRONMENT != "production" or settings.ENABLE_SWAGGER_UI: urlpatterns_custom += [ - url(r"^swagger(?P\.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\.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"), ] diff --git a/gcloud/apigw/urls.py b/gcloud/apigw/urls.py index a4f4751328..b4fb977970 100644 --- a/gcloud/apigw/urls.py +++ b/gcloud/apigw/urls.py @@ -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 @@ -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\d+)/$", get_template_list), - url( + re_path(r"^dispatch_plugin_query/$", dispatch_plugin_query), + re_path(r"^get_template_list/(?P\d+)/$", get_template_list), + re_path( r"^get_template_info/(?P\d+)/(?P\d+)/$", get_template_info, ), - url(r"^get_common_template_list/$", get_common_template_list), - url(r"^get_common_template_info/(?P\d+)/$", get_common_template_info), - url(r"^create_task/(?P\d+)/(?P\d+)/$", create_task), - url(r"^fast_create_task/(?P\d+)/$", fast_create_task), - url(r"^start_task/(?P\d+)/(?P\d+)/$", start_task), - url(r"^operate_task/(?P\d+)/(?P\d+)/$", operate_task), - url(r"^get_task_status/(?P\d+)/(?P\d+)/$", get_task_status), - url(r"^query_task_count/(?P\d+)/$", query_task_count), - url(r"^get_periodic_task_list/(?P\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\d+)/$", get_common_template_info), + re_path(r"^create_task/(?P\d+)/(?P\d+)/$", create_task), + re_path(r"^fast_create_task/(?P\d+)/$", fast_create_task), + re_path(r"^start_task/(?P\d+)/(?P\d+)/$", start_task), + re_path(r"^operate_task/(?P\d+)/(?P\d+)/$", operate_task), + re_path(r"^get_task_status/(?P\d+)/(?P\d+)/$", get_task_status), + re_path(r"^query_task_count/(?P\d+)/$", query_task_count), + re_path(r"^get_periodic_task_list/(?P\d+)/$", get_periodic_task_list), + re_path( r"^get_periodic_task_info/(?P\d+)/(?P\d+)/$", get_periodic_task_info, ), - url( + re_path( r"^create_periodic_task/(?P\d+)/(?P\d+)/$", create_periodic_task, ), - url( + re_path( r"^set_periodic_task_enabled/(?P\d+)/(?P\d+)/$", set_periodic_task_enabled, ), - url( + re_path( r"^modify_cron_for_periodic_task/(?P\d+)/(?P\d+)/$", modify_cron_for_periodic_task, ), - url(r"^modify_constants_for_task/(?P\d+)/(?P\d+)/$", modify_constants_for_task), - url( + re_path(r"^modify_constants_for_task/(?P\d+)/(?P\d+)/$", modify_constants_for_task), + re_path( r"^modify_constants_for_periodic_task/(?P\d+)/(?P\d+)/$", modify_constants_for_periodic_task, ), - url(r"^get_task_list/(?P\d+)/$", get_task_list), - url(r"^get_task_detail/(?P\d+)/(?P\d+)/$", get_task_detail), - url( + re_path(r"^get_task_list/(?P\d+)/$", get_task_list), + re_path(r"^get_task_detail/(?P\d+)/(?P\d+)/$", get_task_detail), + re_path( r"^get_task_node_detail/(?P\d+)/(?P\d+)/$", get_task_node_detail, ), - url(r"^node_callback/(?P\d+)/(?P\d+)/$", node_callback), - url(r"^import_common_template/$", import_common_template), - url(r"^get_plugin_list/(?P\d+)/$", get_plugin_list), - url(r"^get_plugin_detail/(?P\d+)/$", get_plugin_detail), - url(r"^get_user_project_list/$", get_user_project_list), - url(r"^get_user_project_detail/(?P\d+)/$", get_user_project_detail), - url( + re_path(r"^node_callback/(?P\d+)/(?P\d+)/$", node_callback), + re_path(r"^import_common_template/$", import_common_template), + re_path(r"^get_plugin_list/(?P\d+)/$", get_plugin_list), + re_path(r"^get_plugin_detail/(?P\d+)/$", get_plugin_detail), + re_path(r"^get_user_project_list/$", get_user_project_list), + re_path(r"^get_user_project_detail/(?P\d+)/$", get_user_project_detail), + re_path( r"^get_template_schemes/(?P\d+)/(?P\d+)/$", get_template_schemes, ), - url( + re_path( r"^preview_task_tree/(?P\d+)/(?P\d+)/$", preview_task_tree, ), - url( + re_path( r"^get_task_node_data/(?P\d+)/(?P\d+)/$", get_task_node_data, ), - url(r"^operate_node/(?P\d+)/(?P\d+)/$", operate_node), - url(r"^get_tasks_status/(?P\d+)/$", get_tasks_status), - url(r"^get_tasks_manual_intervention_state/(?P\d+)/$", get_tasks_manual_intervention_state), - url(r"^import_project_template/(?P\d+)/$", import_project_template), - url(r"^claim_functionalization_task/(?P\d+)/(?P\d+)/$", claim_functionalization_task), - url(r"^get_functionalization_task_list/$", get_functionalization_task_list), - url(r"^preview_common_task_tree/(?P\d+)/(?P\d+)/$", preview_common_task_tree), - url(r"^register_project/$", register_project), - url(r"^create_and_start_task/(?P\d+)/(?P\d+)/$", create_and_start_task), - url(r"^create_clocked_task/(?P\d+)/(?P\d+)/$", create_clocked_task), - url(r"^get_mini_app_list/(?P\d+)/$", get_mini_app_list), - url(r"^get_task_count/(?P\d+)/$", get_task_count), + re_path(r"^operate_node/(?P\d+)/(?P\d+)/$", operate_node), + re_path(r"^get_tasks_status/(?P\d+)/$", get_tasks_status), + re_path(r"^get_tasks_manual_intervention_state/(?P\d+)/$", get_tasks_manual_intervention_state), + re_path(r"^import_project_template/(?P\d+)/$", import_project_template), + re_path(r"^claim_functionalization_task/(?P\d+)/(?P\d+)/$", claim_functionalization_task), + re_path(r"^get_functionalization_task_list/$", get_functionalization_task_list), + re_path(r"^preview_common_task_tree/(?P\d+)/(?P\d+)/$", preview_common_task_tree), + re_path(r"^register_project/$", register_project), + re_path(r"^create_and_start_task/(?P\d+)/(?P\d+)/$", create_and_start_task), + re_path(r"^create_clocked_task/(?P\d+)/(?P\d+)/$", create_clocked_task), + re_path(r"^get_mini_app_list/(?P\d+)/$", get_mini_app_list), + re_path(r"^get_task_count/(?P\d+)/$", get_task_count), ] diff --git a/gcloud/auto_test/urls.py b/gcloud/auto_test/urls.py index ef245fcd1f..343f37f113 100644 --- a/gcloud/auto_test/urls.py +++ b/gcloud/auto_test/urls.py @@ -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() @@ -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)), ] diff --git a/gcloud/common_template/urls.py b/gcloud/common_template/urls.py index a1010e36bf..3640328ec0 100644 --- a/gcloud/common_template/urls.py +++ b/gcloud/common_template/urls.py @@ -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), ] diff --git a/gcloud/contrib/admin/urls.py b/gcloud/contrib/admin/urls.py index 677e9965f3..6cc2dcde38 100644 --- a/gcloud/contrib/admin/urls.py +++ b/gcloud/contrib/admin/urls.py @@ -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 @@ -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\w+)/$", views.get_cache_key), - url(r"^command/delete_cache_key/(?P\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\w+)/$", views.get_cache_key), + re_path(r"^command/delete_cache_key/(?P\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), ] diff --git a/gcloud/contrib/analysis/urls.py b/gcloud/contrib/analysis/urls.py index 744828f577..7b70fdd7ab 100755 --- a/gcloud/contrib/analysis/urls.py +++ b/gcloud/contrib/analysis/urls.py @@ -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\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\w+)/$", views.get_biz_useage), + path(r"get_component_list/", views.get_component_list), ] diff --git a/gcloud/contrib/appmaker/urls.py b/gcloud/contrib/appmaker/urls.py index 4ccb8f5f71..d98b149116 100755 --- a/gcloud/contrib/appmaker/urls.py +++ b/gcloud/contrib/appmaker/urls.py @@ -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\d+)/$', api.save), - + re_path(r"^save/(?P\d+)/$", api.save), # mini-app 内链接 - # 打开一个轻应用,直接进入参数填写阶段 - url(r'^(?P\d+)/newtask/(?P\d+)/selectnode/$', views.newtask_selectnode), - url(r'^(?P\d+)/newtask/(?P\d+)/paramfill/$', views.newtask_paramfill), + re_path(r"^(?P\d+)/newtask/(?P\d+)/selectnode/$", views.newtask_selectnode), + re_path(r"^(?P\d+)/newtask/(?P\d+)/paramfill/$", views.newtask_paramfill), # 从轻应用的任务记录跳转到任务详情 - url(r'^(?P\d+)/execute/(?P\d+)/$', views.execute), + re_path(r"^(?P\d+)/execute/(?P\d+)/$", views.execute), # 轻应用中任务列表 - url(r'^(?P\d+)/task_home/(?P\d+)/$', views.task_home), - url(r'^get_appmaker_count/(?P\d+)/$', api.get_appmaker_count), + re_path(r"^(?P\d+)/task_home/(?P\d+)/$", views.task_home), + re_path(r"^get_appmaker_count/(?P\d+)/$", api.get_appmaker_count), ] diff --git a/gcloud/contrib/collection/urls.py b/gcloud/contrib/collection/urls.py index 377d8ce985..4c5a6fbf13 100644 --- a/gcloud/contrib/collection/urls.py +++ b/gcloud/contrib/collection/urls.py @@ -1,8 +1,6 @@ # -*- coding: utf-8 -*- -from django.conf.urls import url +from django.urls import re_path from gcloud.contrib.collection.api import BatchCancelCollectionApiView -urlpatterns = ( - url(r"^api/batch_cancel_collection/$", BatchCancelCollectionApiView.as_view()), -) +urlpatterns = (re_path(r"^api/batch_cancel_collection/$", BatchCancelCollectionApiView.as_view()),) diff --git a/gcloud/contrib/develop/urls.py b/gcloud/contrib/develop/urls.py index 33013e5503..47f68160af 100644 --- a/gcloud/contrib/develop/urls.py +++ b/gcloud/contrib/develop/urls.py @@ -11,12 +11,12 @@ specific language governing permissions and limitations under the License. """ -from django.conf.urls import url +from django.urls import re_path from gcloud.contrib.develop import api urlpatterns = [ - url(r'^api/esb_get_systems/$', api.esb_get_systems), - url(r'^api/esb_get_components/$', api.esb_get_components), - url(r'^api/get_plugin_initial_code/$', api.get_plugin_initial_code), + re_path(r"^api/esb_get_systems/$", api.esb_get_systems), + re_path(r"^api/esb_get_components/$", api.esb_get_components), + re_path(r"^api/get_plugin_initial_code/$", api.get_plugin_initial_code), ] diff --git a/gcloud/contrib/function/urls.py b/gcloud/contrib/function/urls.py index 59cfbda456..d6fd412f19 100644 --- a/gcloud/contrib/function/urls.py +++ b/gcloud/contrib/function/urls.py @@ -1,8 +1,6 @@ # -*- coding: utf-8 -*- -from django.conf.urls import url +from django.urls import re_path from gcloud.contrib.function import api -urlpatterns = ( - url(r"^api/function_task_claimant_transfer/$", api.FunctionTaskClaimantTransferView.as_view()), -) +urlpatterns = (re_path(r"^api/function_task_claimant_transfer/$", api.FunctionTaskClaimantTransferView.as_view()),) diff --git a/gcloud/core/urls.py b/gcloud/core/urls.py index 9e62d4f544..d43eaf58a8 100644 --- a/gcloud/core/urls.py +++ b/gcloud/core/urls.py @@ -12,7 +12,7 @@ """ from blueapps.account.decorators import login_exempt from django.apps import apps -from django.conf.urls import include, url +from django.urls import include, re_path from django.views.i18n import JavaScriptCatalog from version_log import config as version_log_config @@ -25,25 +25,25 @@ urlpatterns = [ - url(r"^$", views.home), - url(r"^logout$", views.user_exit), - url(r"^core/api/change_default_project/(?P\d+)/$", api.change_default_project), - url(r"^core/api/get_roles_and_personnel/(?P\d+)/$", api.get_roles_and_personnel), - url(r"^core/api/get_basic_info/$", api.get_basic_info), - url(r"^core/footer/$", api.get_footer), - url(r"^core/footer_info/$", api.get_footer_info), - url(r"^core/api/get_user_list/$", api.get_user_list), - url(r"^core/api/get_msg_types/$", api.get_msg_types), - url(r"^core/healthz", api.healthz), - url(r"^core/api/check_variable_key", api.check_variable_key), + re_path(r"^$", views.home), + re_path(r"^logout$", views.user_exit), + re_path(r"^core/api/change_default_project/(?P\d+)/$", api.change_default_project), + re_path(r"^core/api/get_roles_and_personnel/(?P\d+)/$", api.get_roles_and_personnel), + re_path(r"^core/api/get_basic_info/$", api.get_basic_info), + re_path(r"^core/footer/$", api.get_footer), + re_path(r"^core/footer_info/$", api.get_footer_info), + re_path(r"^core/api/get_user_list/$", api.get_user_list), + re_path(r"^core/api/get_msg_types/$", api.get_msg_types), + re_path(r"^core/healthz", api.healthz), + re_path(r"^core/api/check_variable_key", api.check_variable_key), # i18n - url(r"^jsi18n/gcloud/$", javascript_catalog), + re_path(r"^jsi18n/gcloud/$", javascript_catalog), # version log - url(r"^{}".format(version_log_config.ENTRANCE_URL), include("version_log.urls")), + re_path(r"^{}".format(version_log_config.ENTRANCE_URL), include("version_log.urls")), # iam resource api - url(r"^iam/resource/api/v1/$", dispatcher.as_view([login_exempt])), + re_path(r"^iam/resource/api/v1/$", dispatcher.as_view([login_exempt])), # iam api - url(r"^iam/api/", include("gcloud.iam_auth.urls")), + re_path(r"^iam/api/", include("gcloud.iam_auth.urls")), # django prom - url(r"^metrics/$", views.metrics), + re_path(r"^metrics/$", views.metrics), ] diff --git a/gcloud/iam_auth/urls.py b/gcloud/iam_auth/urls.py index 4b444b8c9f..9fb2650339 100644 --- a/gcloud/iam_auth/urls.py +++ b/gcloud/iam_auth/urls.py @@ -11,13 +11,13 @@ specific language governing permissions and limitations under the License. """ -from django.conf.urls import url +from django.urls import re_path from gcloud.iam_auth import api urlpatterns = [ - url(r"^meta/$", api.meta_info), - url(r"^apply_perms_url/$", api.apply_perms_url), - url(r"^is_allow/$", api.is_allow), - url(r"^is_allow/common_flow_management/$", api.is_allow_common_flow_management), + re_path(r"^meta/$", api.meta_info), + re_path(r"^apply_perms_url/$", api.apply_perms_url), + re_path(r"^is_allow/$", api.is_allow), + re_path(r"^is_allow/common_flow_management/$", api.is_allow_common_flow_management), ] diff --git a/gcloud/mako_template_helper/urls.py b/gcloud/mako_template_helper/urls.py index 82bfcfa816..a8e72fb7d9 100644 --- a/gcloud/mako_template_helper/urls.py +++ b/gcloud/mako_template_helper/urls.py @@ -11,8 +11,8 @@ specific language governing permissions and limitations under the License. """ -from django.conf.urls import url +from django.urls import path from gcloud.mako_template_helper.apis.viewsets.mako_operations import MakoOperationsView -urlpatterns = [url(r"", MakoOperationsView.as_view())] +urlpatterns = [path(r"", MakoOperationsView.as_view())] diff --git a/gcloud/periodictask/urls.py b/gcloud/periodictask/urls.py index 9641bb39ef..26ecc6868e 100644 --- a/gcloud/periodictask/urls.py +++ b/gcloud/periodictask/urls.py @@ -11,12 +11,12 @@ specific language governing permissions and limitations under the License. """ -from django.conf.urls import url +from django.urls import re_path from gcloud.periodictask import api urlpatterns = [ - url(r'^api/enabled/(?P\d+)/(?P\d+)/$', api.set_enabled_for_periodic_task), - url(r'^api/cron/(?P\d+)/(?P\d+)/$', api.modify_cron), - url(r'^api/constants/(?P\d+)/(?P\d+)/$', api.modify_constants) + re_path(r"^api/enabled/(?P\d+)/(?P\d+)/$", api.set_enabled_for_periodic_task), + re_path(r"^api/cron/(?P\d+)/(?P\d+)/$", api.modify_cron), + re_path(r"^api/constants/(?P\d+)/(?P\d+)/$", api.modify_constants), ] diff --git a/gcloud/resources/urls.py b/gcloud/resources/urls.py index bf6849e028..019cf21d8d 100644 --- a/gcloud/resources/urls.py +++ b/gcloud/resources/urls.py @@ -11,23 +11,18 @@ 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.clocked_task.viewset import ClockedTaskViewSet -from gcloud.contrib.operate_record.apis.drf.viewsets import ( - TaskOperateRecordSetViewSet, - TemplateOperateRecordSetViewSet, -) +from gcloud.contrib.operate_record.apis.drf.viewsets import TaskOperateRecordSetViewSet, TemplateOperateRecordSetViewSet from gcloud.core.apis.drf.viewsets import ( AppmakerListViewSet, BusinessSetViewSet, CollectionViewSet, CommonProjectViewSet, ) -from gcloud.core.apis.drf.viewsets import ( - CommonTemplateViewSet as V3CommonTemplateViewSet, -) +from gcloud.core.apis.drf.viewsets import CommonTemplateViewSet as V3CommonTemplateViewSet from gcloud.core.apis.drf.viewsets import ( ComponentModelSetViewSet, FunctionTaskViewSet, @@ -47,14 +42,9 @@ from gcloud.label.viewsets import NewLabelViewSet from gcloud.project_constants.apis.drf.viewsets import ProjectConstantsViewSet from gcloud.template_base.apis.drf.viewsets import TemplateSchemeViewSet -from gcloud.template_base.apis.drf.viewsets.template import ( - CommonTemplateViewSet, - ProjectTemplateViewSet, -) +from gcloud.template_base.apis.drf.viewsets.template import CommonTemplateViewSet, ProjectTemplateViewSet from gcloud.user_custom_config.viewsets.user_custom_config import UserCustomConfViewset -from gcloud.user_custom_config.viewsets.user_custom_config_options import ( - UserCustomConfigOptions, -) +from gcloud.user_custom_config.viewsets.user_custom_config_options import UserCustomConfigOptions drf_router = DefaultRouter() drf_router.register(r"project_config", ProjectConfigViewSet) @@ -68,9 +58,9 @@ drf_router.register(r"business", BusinessSetViewSet) drf_router.register(r"component", ComponentModelSetViewSet, basename="component") drf_router.register(r"project", ProjectSetViewSet) -drf_router.register(r"user_project", UserProjectSetViewSet) +drf_router.register(r"user_project", UserProjectSetViewSet, basename="user_project") drf_router.register(r"common_project", CommonProjectViewSet) -drf_router.register(r"label", LabelViewSet) +drf_router.register(r"label", LabelViewSet, basename="unique_label") drf_router.register(r"package_source", PackageSourceViewSet, basename="package_source") drf_router.register(r"sync_task", SyncTaskViewSet) drf_router.register(r"collection", CollectionViewSet) @@ -96,7 +86,7 @@ # Standard bits... urlpatterns = [ - url(r"^api/v3/", include(drf_router.urls)), - url(r"^api/v4/", include(v4_drf_router.urls)), - url(r"^api/auto_test/", include("gcloud.auto_test.urls")), + re_path(r"^api/v3/", include(drf_router.urls)), + re_path(r"^api/v4/", include(v4_drf_router.urls)), + re_path(r"^api/auto_test/", include("gcloud.auto_test.urls")), ] diff --git a/gcloud/taskflow3/apis/django/v4/urls.py b/gcloud/taskflow3/apis/django/v4/urls.py index cfe6f78ce8..5d66293ba2 100644 --- a/gcloud/taskflow3/apis/django/v4/urls.py +++ b/gcloud/taskflow3/apis/django/v4/urls.py @@ -11,14 +11,14 @@ specific language governing permissions and limitations under the License. """ -from django.conf.urls import url +from django.urls import re_path from .node_action import node_action from .node_callback import node_callback from .state import root_state v4_urlpatterns = [ - url(r"^node_action/(?P\d+)/(?P\d+)/(?P\w+)/$", node_action), - url(r"^nodes/callback/(?P.+)/$", node_callback), - url(r"^root_state/(?P\d+)/$", root_state), + re_path(r"^node_action/(?P\d+)/(?P\d+)/(?P\w+)/$", node_action), + re_path(r"^nodes/callback/(?P.+)/$", node_callback), + re_path(r"^root_state/(?P\d+)/$", root_state), ] diff --git a/gcloud/taskflow3/urls.py b/gcloud/taskflow3/urls.py index d081582c94..30b73ee60c 100644 --- a/gcloud/taskflow3/urls.py +++ b/gcloud/taskflow3/urls.py @@ -11,8 +11,7 @@ specific language governing permissions and limitations under the License. """ -from django.conf.urls import include, url -from django.urls import path +from django.urls import include, path, re_path from gcloud.taskflow3.apis.django import api from gcloud.taskflow3.apis.django.v4.urls import v4_urlpatterns @@ -22,23 +21,23 @@ from gcloud.taskflow3.apis.drf.viewsets.update_task_constants import UpdateTaskConstantsView urlpatterns = [ - url(r"^api/context/$", api.context), - url(r"^api/status/(?P\d+)/$", api.status), - url(r"^api/batch_status/(?P\d+)/$", api.batch_status), - url(r"^api/clone/(?P\d+)/$", api.task_clone), - url(r"^api/action/(?P\w+)/(?P\d+)/$", api.task_action), - url(r"^api/flow/claim/(?P\d+)/$", api.task_func_claim), - url(r"^api/nodes/action/(?P\w+)/(?P\d+)/$", api.nodes_action), - url(r"^api/nodes/data/(?P\d+)/$", api.data), - url(r"^api/nodes/detail/(?P\d+)/$", api.detail), - url(r"^api/nodes/get_job_instance_log/(?P\d+)/$", api.get_job_instance_log), - url(r"^api/nodes/spec/timer/reset/(?P\d+)/$", api.spec_nodes_timer_reset), - url(r"^api/preview_task_tree/(?P\d+)/$", api.preview_task_tree), - url(r"^api/query_task_count/(?P\d+)/$", api.query_task_count), - url(r"^api/nodes/log/(?P\d+)/(?P\w+)/$", api.get_node_log), - url(r"^api/get_task_create_method/$", api.get_task_create_method), - url(r"^api/nodes/callback/(?P.+)/$", api.node_callback), - url(r"^api/v4/", include(v4_urlpatterns)), + re_path(r"^api/context/$", api.context), + re_path(r"^api/status/(?P\d+)/$", api.status), + re_path(r"^api/batch_status/(?P\d+)/$", api.batch_status), + re_path(r"^api/clone/(?P\d+)/$", api.task_clone), + re_path(r"^api/action/(?P\w+)/(?P\d+)/$", api.task_action), + re_path(r"^api/flow/claim/(?P\d+)/$", api.task_func_claim), + re_path(r"^api/nodes/action/(?P\w+)/(?P\d+)/$", api.nodes_action), + re_path(r"^api/nodes/data/(?P\d+)/$", api.data), + re_path(r"^api/nodes/detail/(?P\d+)/$", api.detail), + re_path(r"^api/nodes/get_job_instance_log/(?P\d+)/$", api.get_job_instance_log), + re_path(r"^api/nodes/spec/timer/reset/(?P\d+)/$", api.spec_nodes_timer_reset), + re_path(r"^api/preview_task_tree/(?P\d+)/$", api.preview_task_tree), + re_path(r"^api/query_task_count/(?P\d+)/$", api.query_task_count), + re_path(r"^api/nodes/log/(?P\d+)/(?P\w+)/$", api.get_node_log), + re_path(r"^api/get_task_create_method/$", api.get_task_create_method), + re_path(r"^api/nodes/callback/(?P.+)/$", api.node_callback), + re_path(r"^api/v4/", include(v4_urlpatterns)), path(r"api/render_current_constants//", RenderCurrentConstantsView.as_view()), path( r"api/engine_v2/node_log/////", diff --git a/gcloud/tasktmpl3/urls.py b/gcloud/tasktmpl3/urls.py index bc6f2dcb02..dc76f2262f 100644 --- a/gcloud/tasktmpl3/urls.py +++ b/gcloud/tasktmpl3/urls.py @@ -11,29 +11,31 @@ specific language governing permissions and limitations under the License. """ -from django.conf.urls import url +from django.urls import re_path from gcloud.tasktmpl3.apis.django import api -from gcloud.tasktmpl3.apis.drf.viewsets.variable_field_explain import VariableFieldExplainView -from gcloud.tasktmpl3.apis.drf.viewsets.form_with_schemes import TemplateFormWithSchemesView from gcloud.tasktmpl3.apis.drf.viewsets.batch_form_with_schemes import BatchTemplateFormWithSchemesView +from gcloud.tasktmpl3.apis.drf.viewsets.form_with_schemes import TemplateFormWithSchemesView +from gcloud.tasktmpl3.apis.drf.viewsets.variable_field_explain import VariableFieldExplainView urlpatterns = [ # [deprecated] this api will be instead of form_with_schemes - url(r"^api/form/(?P\d+)/$", api.form), + re_path(r"^api/form/(?P\d+)/$", api.form), # [deprecated] this api will be instead of batch_form_with_schemes - url(r"^api/batch_form/(?P\d+)/$", api.batch_form), - url(r"^api/export/(?P\d+)/$", api.export_templates), - url(r"^api/import/(?P\d+)/$", api.import_templates), - url(r"^api/import_check/(?P\d+)/$", api.check_before_import), - url(r"^api/replace_node_id/$", api.replace_all_templates_tree_node_id), - url(r"^api/draw_pipeline/$", api.draw_pipeline), - url(r"^api/get_template_count/(?P\d+)/$", api.get_template_count), - url(r"^api/get_templates_with_expired_subprocess/(?P\d+)/$", api.get_templates_with_expired_subprocess), - url(r"^api/get_constant_preview_result/$", api.get_constant_preview_result), - url(r"^api/analysis_constants_ref/$", api.analysis_constants_ref), - url(r"^api/parents/(?P\d+)/$", api.parents), - url(r"^api/variable_field_explain/$", VariableFieldExplainView.as_view()), - url(r"^api/form_with_schemes/", TemplateFormWithSchemesView.as_view()), - url(r"^api/batch_form_with_schemes/", BatchTemplateFormWithSchemesView.as_view()), + re_path(r"^api/batch_form/(?P\d+)/$", api.batch_form), + re_path(r"^api/export/(?P\d+)/$", api.export_templates), + re_path(r"^api/import/(?P\d+)/$", api.import_templates), + re_path(r"^api/import_check/(?P\d+)/$", api.check_before_import), + re_path(r"^api/replace_node_id/$", api.replace_all_templates_tree_node_id), + re_path(r"^api/draw_pipeline/$", api.draw_pipeline), + re_path(r"^api/get_template_count/(?P\d+)/$", api.get_template_count), + re_path( + r"^api/get_templates_with_expired_subprocess/(?P\d+)/$", api.get_templates_with_expired_subprocess + ), + re_path(r"^api/get_constant_preview_result/$", api.get_constant_preview_result), + re_path(r"^api/analysis_constants_ref/$", api.analysis_constants_ref), + re_path(r"^api/parents/(?P\d+)/$", api.parents), + re_path(r"^api/variable_field_explain/$", VariableFieldExplainView.as_view()), + re_path(r"^api/form_with_schemes/", TemplateFormWithSchemesView.as_view()), + re_path(r"^api/batch_form_with_schemes/", BatchTemplateFormWithSchemesView.as_view()), ] diff --git a/gcloud/template_base/urls.py b/gcloud/template_base/urls.py index b6311a2287..25a44418f4 100644 --- a/gcloud/template_base/urls.py +++ b/gcloud/template_base/urls.py @@ -11,8 +11,7 @@ specific language governing permissions and limitations under the License. """ -from django.conf.urls import url -from django.urls import include +from django.urls import include, re_path from rest_framework.routers import DefaultRouter from .apis.django import api @@ -23,8 +22,8 @@ urlpatterns = [ - url(r"^api/upload_yaml_templates/$", api.upload_and_check_yaml_templates), - url(r"^api/export_yaml_templates/$", api.export_yaml_templates), - url(r"^api/import_yaml_templates/$", api.import_yaml_templates), - url(r"^api/", include(router.urls)), + re_path(r"^api/upload_yaml_templates/$", api.upload_and_check_yaml_templates), + re_path(r"^api/export_yaml_templates/$", api.export_yaml_templates), + re_path(r"^api/import_yaml_templates/$", api.import_yaml_templates), + re_path(r"^api/", include(router.urls)), ] diff --git a/pipeline_plugins/base/urls.py b/pipeline_plugins/base/urls.py index 2445707d28..01d2fd6ed2 100644 --- a/pipeline_plugins/base/urls.py +++ b/pipeline_plugins/base/urls.py @@ -11,12 +11,11 @@ specific language governing permissions and limitations under the License. """ -from django.conf.urls import url +from django.urls import re_path from pipeline_plugins.base.query import cmdb - urlpatterns = [ - url(r'^cc_get_host_by_module_id/(?P\d+)/$', cmdb.cc_get_host_by_module_id), - url(r'^cc_search_module/(?P\d+)/$', cmdb.cc_search_module), + re_path(r"^cc_get_host_by_module_id/(?P\d+)/$", cmdb.cc_get_host_by_module_id), + re_path(r"^cc_search_module/(?P\d+)/$", cmdb.cc_search_module), ] diff --git a/pipeline_plugins/cmdb_ip_picker/urls.py b/pipeline_plugins/cmdb_ip_picker/urls.py index 463b0db561..09bc164142 100644 --- a/pipeline_plugins/cmdb_ip_picker/urls.py +++ b/pipeline_plugins/cmdb_ip_picker/urls.py @@ -11,12 +11,12 @@ specific language governing permissions and limitations under the License. """ -from django.conf.urls import url +from django.urls import re_path from . import query urlpatterns = [ - url(r'^cmdb_search_topo_tree/(?P\d+)/$', query.cmdb_search_topo_tree), - url(r'^cmdb_search_host/(?P\d+)/$', query.cmdb_search_host), - url(r'^cmdb_get_mainline_object_topo/(?P\d+)/$', query.cmdb_get_mainline_object_topo), + re_path(r"^cmdb_search_topo_tree/(?P\d+)/$", query.cmdb_search_topo_tree), + re_path(r"^cmdb_search_host/(?P\d+)/$", query.cmdb_search_host), + re_path(r"^cmdb_get_mainline_object_topo/(?P\d+)/$", query.cmdb_get_mainline_object_topo), ] diff --git a/pipeline_plugins/components/query/sites/open/cc.py b/pipeline_plugins/components/query/sites/open/cc.py index 225c23fec2..518027ea9b 100644 --- a/pipeline_plugins/components/query/sites/open/cc.py +++ b/pipeline_plugins/components/query/sites/open/cc.py @@ -15,30 +15,25 @@ import traceback from django.http import JsonResponse -from django.conf.urls import url - +from django.urls import path, re_path +from django.utils.translation import ugettext_lazy as _ from iam.contrib.http import HTTP_AUTH_FORBIDDEN_CODE from iam.exceptions import RawAuthFailedException from api.utils.request import batch_request +from gcloud.conf import settings +from gcloud.core.utils import get_user_business_list +from gcloud.exceptions import APIError, ApiRequestError from gcloud.iam_auth.utils import check_and_raise_raw_auth_fail_exception -from pipeline_plugins.base.utils.inject import ( - supplier_account_inject, - supplier_id_inject, -) +from gcloud.utils.handlers import handle_api_error +from pipeline_plugins.base.utils.inject import supplier_account_inject, supplier_id_inject from pipeline_plugins.cmdb_ip_picker.query import ( - cmdb_search_host, - cmdb_search_topo_tree, cmdb_get_mainline_object_topo, cmdb_search_dynamic_group, + cmdb_search_host, + cmdb_search_topo_tree, ) - -from gcloud.conf import settings -from gcloud.utils.handlers import handle_api_error -from gcloud.exceptions import APIError, ApiRequestError -from gcloud.core.utils import get_user_business_list from pipeline_plugins.components.utils import batch_execute_func -from django.utils.translation import ugettext_lazy as _ logger = logging.getLogger("root") get_client_by_user = settings.ESB_GET_CLIENT_BY_USER @@ -397,7 +392,9 @@ def cc_get_editable_module_attribute(request, biz_cc_id): result = client.cc.search_object_attribute(kwargs) if not result["result"]: check_and_raise_raw_auth_fail_exception(result) - message = _(f"业务配置数据请求失败: 请求[配置平台]接口发生异常: {result['message']} | cc_get_editable_module_attribute") + message = _( + f"业务配置数据请求失败: 请求[配置平台]接口发生异常: {result['message']} | cc_get_editable_module_attribute" + ) logger.error(message) return JsonResponse({"result": False, "data": message}) data = result["data"] @@ -441,7 +438,9 @@ def cc_get_editable_set_attribute(request, biz_cc_id): result = client.cc.search_object_attribute(kwargs) if not result["result"]: check_and_raise_raw_auth_fail_exception(result) - message = _(f"业务配置数据请求失败: 请求[配置平台]接口发生异常: {result['message']} | cc_get_editable_set_attribute") + message = _( + f"业务配置数据请求失败: 请求[配置平台]接口发生异常: {result['message']} | cc_get_editable_set_attribute" + ) logger.error(message) return JsonResponse({"result": False, "data": message}) data = result["data"] @@ -540,53 +539,53 @@ def list_business_set(request): cc_urlpatterns = [ - url(r"^cc_get_editable_module_attribute/(?P\d+)/$", cc_get_editable_module_attribute), - url( + re_path(r"^cc_get_editable_module_attribute/(?P\d+)/$", cc_get_editable_module_attribute), + re_path( r"^cc_search_object_attribute/(?P\w+)/(?P\d+)/$", cc_search_object_attribute, ), - url( + re_path( r"^cc_search_object_attribute_all/(?P\w+)/(?P\d+)/$", cc_search_object_attribute_all, ), - url( + re_path( r"^cc_search_create_object_attribute/(?P\w+)/(?P\d+)/$", cc_search_create_object_attribute, ), - url( + re_path( r"^cc_search_topo/(?P\w+)/(?P\w+)/(?P\d+)/$", cc_search_topo, ), - url( + re_path( r"^cc_list_service_category/(?P\w+)/(?P\w+)/$", cc_list_service_category, ), - url( + re_path( r"^cc_list_service_template/(?P\d+)/$", cc_list_service_template, ), - url( + re_path( r"^cc_get_service_category_topo/(?P\d+)/$", cc_get_service_category_topo, ), # IP selector - url(r"^cc_search_topo_tree/(?P\d+)/$", cc_search_topo_tree), - url(r"^cc_search_host/(?P\d+)/$", cc_search_host), - url( + re_path(r"^cc_search_topo_tree/(?P\d+)/$", cc_search_topo_tree), + re_path(r"^cc_search_host/(?P\d+)/$", cc_search_host), + re_path( r"^cc_get_mainline_object_topo/(?P\d+)/$", cc_get_mainline_object_topo, ), - url(r"^cc_get_business_list/$", cc_get_business), - url(r"^cc_search_dynamic_group/(?P\d+)/$", cc_search_dynamic_group), + re_path(r"^cc_get_business_list/$", cc_get_business), + re_path(r"^cc_search_dynamic_group/(?P\d+)/$", cc_search_dynamic_group), # 查询集群模板 - url(r"^cc_list_set_template/(?P\d+)/$", cc_list_set_template), + re_path(r"^cc_list_set_template/(?P\d+)/$", cc_list_set_template), # 主机自定义属性表格 - url(r"^cc_input_host_property/(?P\d+)/$", cc_input_host_property), + re_path(r"^cc_input_host_property/(?P\d+)/$", cc_input_host_property), # 查询Set服务状态 - url(r"^cc_search_status_options/(?P\d+)/$", cc_search_status_options), + re_path(r"^cc_search_status_options/(?P\d+)/$", cc_search_status_options), # 获取可更改的set属性 - url(r"^cc_get_set_attribute/(?P\d+)/$", cc_get_editable_set_attribute), + re_path(r"^cc_get_set_attribute/(?P\d+)/$", cc_get_editable_set_attribute), # 批量查询拓扑节点下的主机 - url(r"^cc_find_host_by_topo/(?P\d+)/$", cc_find_host_by_topo), - url("list_business_set/", list_business_set), + re_path(r"^cc_find_host_by_topo/(?P\d+)/$", cc_find_host_by_topo), + path("list_business_set/", list_business_set), ] diff --git a/pipeline_plugins/components/query/sites/open/file_upload.py b/pipeline_plugins/components/query/sites/open/file_upload.py index 80b3c26ac5..bb3b843ae5 100644 --- a/pipeline_plugins/components/query/sites/open/file_upload.py +++ b/pipeline_plugins/components/query/sites/open/file_upload.py @@ -14,17 +14,16 @@ import traceback from django.http import JsonResponse +from django.urls import re_path from django.utils.translation import ugettext_lazy as _ -from django.conf.urls import url -from iam import Subject, Action +from iam import Action, Subject from iam.shortcuts import allow_or_raise_auth_failed +from files.factory import BartenderFactory, ManagerFactory from files.models import UploadTicket -from files.factory import ManagerFactory, BartenderFactory - from gcloud.conf import settings from gcloud.core.models import EnvironmentVariables -from gcloud.iam_auth import IAMMeta, res_factory, get_iam_client +from gcloud.iam_auth import IAMMeta, get_iam_client, res_factory logger = logging.getLogger("root") get_client_by_user = settings.ESB_GET_CLIENT_BY_USER @@ -100,7 +99,9 @@ def get_repo_temporary_upload_url(request): shims = request.GET.get("shims", "frontend_upload") if not str(bk_biz_id) or not str(name): - message = _("文件上传失败: 业务ID和业务名称都应该提供.请重试, 如持续失败可联系管理员处理. | get_repo_temporary_upload_url") + message = _( + "文件上传失败: 业务ID和业务名称都应该提供.请重试, 如持续失败可联系管理员处理. | get_repo_temporary_upload_url" + ) logger.error(message) return JsonResponse({"result": False, "message": message}) @@ -112,7 +113,7 @@ def get_repo_temporary_upload_url(request): file_upload_urlpatterns = [ - url(r"^file_upload/$", file_upload), - url(r"^apply_upload_ticket/$", apply_upload_ticket), - url(r"^get_repo_temporary_upload_url/$", get_repo_temporary_upload_url), + re_path(r"^file_upload/$", file_upload), + re_path(r"^apply_upload_ticket/$", apply_upload_ticket), + re_path(r"^get_repo_temporary_upload_url/$", get_repo_temporary_upload_url), ] diff --git a/pipeline_plugins/components/query/sites/open/gsekit.py b/pipeline_plugins/components/query/sites/open/gsekit.py index e3815a16c8..bcd0358763 100644 --- a/pipeline_plugins/components/query/sites/open/gsekit.py +++ b/pipeline_plugins/components/query/sites/open/gsekit.py @@ -13,7 +13,7 @@ import logging from django.http import JsonResponse -from django.conf.urls import url +from django.urls import re_path from api import BKGseKitClient @@ -36,5 +36,5 @@ def gsekit_get_config_template_list(request, biz_cc_id): gsekit_urlpatterns = [ - url(r"^gsekit_get_config_template_list/(?P\d+)/$", gsekit_get_config_template_list), + re_path(r"^gsekit_get_config_template_list/(?P\d+)/$", gsekit_get_config_template_list), ] diff --git a/pipeline_plugins/components/query/sites/open/itsm.py b/pipeline_plugins/components/query/sites/open/itsm.py index 27a3b938d5..3f78a87ae2 100644 --- a/pipeline_plugins/components/query/sites/open/itsm.py +++ b/pipeline_plugins/components/query/sites/open/itsm.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- import logging -from django.conf.urls import url +from django.urls import re_path from drf_yasg.utils import swagger_auto_schema +from rest_framework import permissions, serializers from rest_framework.decorators import action from rest_framework.response import Response from rest_framework.views import APIView -from rest_framework import permissions, serializers from api.collections.itsm import BKItsmClient from gcloud.iam_auth.utils import check_and_raise_raw_auth_fail_exception @@ -158,4 +158,4 @@ def post(self, request): return Response({"result": True, "data": None}) -itsm_urlpatterns = [url(r"^itsm/node_transition/$", ITSMNodeTransitionView.as_view())] +itsm_urlpatterns = [re_path(r"^itsm/node_transition/$", ITSMNodeTransitionView.as_view())] diff --git a/pipeline_plugins/components/query/sites/open/job.py b/pipeline_plugins/components/query/sites/open/job.py index 4e6ebfaea4..6318acf851 100644 --- a/pipeline_plugins/components/query/sites/open/job.py +++ b/pipeline_plugins/components/query/sites/open/job.py @@ -15,11 +15,10 @@ import time from django.http import JsonResponse +from django.urls import re_path from django.utils.translation import ugettext_lazy as _ -from django.conf.urls import url from api.utils.request import batch_request - from gcloud.conf import settings from gcloud.constants import JobBizScopeType from gcloud.iam_auth.utils import check_and_raise_raw_auth_fail_exception @@ -190,7 +189,9 @@ def job_get_job_task_detail(request, biz_cc_id, task_id): global_var = [] steps = [] if not task_detail: - message = _(f"请求执行方案失败: 请求作业平台执行方案详情返回数据为空: {job_result}. 请重试, 如持续失败请联系管理员处理 | job_get_job_task_detail") + message = _( + f"请求执行方案失败: 请求作业平台执行方案详情返回数据为空: {job_result}. 请重试, 如持续失败请联系管理员处理 | job_get_job_task_detail" + ) logger.error(message) return JsonResponse({"result": False, "message": message}) @@ -220,7 +221,9 @@ def job_get_job_task_detail(request, biz_cc_id, task_id): ] ) else: - message = _(f"执行历史请求失败: 请求[作业平台]执行历史列表发生异常: 未知类型变量: {var} | job_get_job_task_detail") + message = _( + f"执行历史请求失败: 请求[作业平台]执行历史列表发生异常: 未知类型变量: {var} | job_get_job_task_detail" + ) logger.warning(message) continue @@ -372,7 +375,9 @@ def jobv3_get_job_plan_detail(request, biz_cc_id, job_plan_id): plan_detail = jobv3_result["data"] global_var = [] if not plan_detail: - message = _(f"请求执行方案失败: 请求作业平台执行方案详情返回数据为空: {jobv3_result}. 请重试, 如持续失败请联系管理员处理 | jobv3_get_job_plan_detail") + message = _( + f"请求执行方案失败: 请求作业平台执行方案详情返回数据为空: {jobv3_result}. 请重试, 如持续失败请联系管理员处理 | jobv3_get_job_plan_detail" + ) logger.error(message) return JsonResponse({"result": False, "message": message}) @@ -399,7 +404,9 @@ def jobv3_get_job_plan_detail(request, biz_cc_id, job_plan_id): ] ) else: - message = _(f"执行历史请求失败: 请求[作业平台]执行历史列表发生异常: 未知类型变量: {var} | jobv3_get_job_plan_detail") + message = _( + f"执行历史请求失败: 请求[作业平台]执行历史列表发生异常: 未知类型变量: {var} | jobv3_get_job_plan_detail" + ) logger.error(message) result = {"result": False, "message": message} return JsonResponse(result) @@ -427,7 +434,8 @@ def jobv3_get_instance_list(request, biz_cc_id, type, status): "bk_scope_id": str(biz_cc_id), "bk_biz_id": biz_cc_id, "create_time_end": int(round(time.time() * 1000)) + TEN_MINUTES_MILLISECONDS * 1, - "create_time_start": int(round(time.time() * 1000)) - TEN_MINUTES_MILLISECONDS * 1, # 取一天前到一天后这段时间的历史 + "create_time_start": int(round(time.time() * 1000)) + - TEN_MINUTES_MILLISECONDS * 1, # 取一天前到一天后这段时间的历史 "operator": username, "status": int(status), "type": int(type), @@ -472,17 +480,20 @@ def get_job_account_list(request, biz_cc_id): job_urlpatterns = [ - url(r"^job_get_script_list/(?P\d+)/$", job_get_script_list), - url(r"^get_job_account_list/(?P\d+)/$", get_job_account_list), - url(r"^job_get_script_name_list/(?P\d+)/$", job_get_script_name_list), - url(r"^job_get_public_script_name_list/$", job_get_public_script_name_list), - url(r"^job_get_script_by_script_version/(?P\d+)/$", job_get_script_by_script_version), - url(r"^job_get_job_tasks_by_biz/(?P\d+)/$", job_get_job_tasks_by_biz), - url(r"^job_get_job_detail_by_biz/(?P\d+)/(?P\d+)/$", job_get_job_task_detail,), - url(r"^job_get_instance_detail/(?P\d+)/(?P\d+)/$", job_get_instance_detail), + re_path(r"^job_get_script_list/(?P\d+)/$", job_get_script_list), + re_path(r"^get_job_account_list/(?P\d+)/$", get_job_account_list), + re_path(r"^job_get_script_name_list/(?P\d+)/$", job_get_script_name_list), + re_path(r"^job_get_public_script_name_list/$", job_get_public_script_name_list), + re_path(r"^job_get_script_by_script_version/(?P\d+)/$", job_get_script_by_script_version), + re_path(r"^job_get_job_tasks_by_biz/(?P\d+)/$", job_get_job_tasks_by_biz), + re_path( + r"^job_get_job_detail_by_biz/(?P\d+)/(?P\d+)/$", + job_get_job_task_detail, + ), + re_path(r"^job_get_instance_detail/(?P\d+)/(?P\d+)/$", job_get_instance_detail), # jobv3接口 - url(r"^jobv3_get_job_template_list/(?P\d+)/$", jobv3_get_job_template_list), - url(r"^jobv3_get_job_plan_list/(?P\d+)/(?P\d+)/$", jobv3_get_job_plan_list), - url(r"^jobv3_get_job_plan_detail/(?P\d+)/(?P\d+)/$", jobv3_get_job_plan_detail), - url(r"^jobv3_get_instance_list/(?P\d+)/(?P\d+)/(?P\d+)/$", jobv3_get_instance_list), + re_path(r"^jobv3_get_job_template_list/(?P\d+)/$", jobv3_get_job_template_list), + re_path(r"^jobv3_get_job_plan_list/(?P\d+)/(?P\d+)/$", jobv3_get_job_plan_list), + re_path(r"^jobv3_get_job_plan_detail/(?P\d+)/(?P\d+)/$", jobv3_get_job_plan_detail), + re_path(r"^jobv3_get_instance_list/(?P\d+)/(?P\d+)/(?P\d+)/$", jobv3_get_instance_list), ] diff --git a/pipeline_plugins/components/query/sites/open/monitor.py b/pipeline_plugins/components/query/sites/open/monitor.py index f234fc7b82..7b403d4cff 100644 --- a/pipeline_plugins/components/query/sites/open/monitor.py +++ b/pipeline_plugins/components/query/sites/open/monitor.py @@ -2,12 +2,11 @@ import logging -from django.conf.urls import url - -from api import BKMonitorClient -from django.utils.translation import ugettext_lazy as _ from django.http import JsonResponse +from django.urls import re_path +from django.utils.translation import ugettext_lazy as _ +from api import BKMonitorClient from gcloud.iam_auth.utils import check_and_raise_raw_auth_fail_exception logger = logging.getLogger("root") @@ -30,4 +29,4 @@ def monitor_get_strategy(request, biz_cc_id): return JsonResponse({"result": True, "data": strategy_list}) -monitor_urlpatterns = [url(r"^monitor_get_strategy/(?P\d+)/$", monitor_get_strategy)] +monitor_urlpatterns = [re_path(r"^monitor_get_strategy/(?P\d+)/$", monitor_get_strategy)] diff --git a/pipeline_plugins/components/query/sites/open/nodeman.py b/pipeline_plugins/components/query/sites/open/nodeman.py index 229c3d1108..f96838acd0 100644 --- a/pipeline_plugins/components/query/sites/open/nodeman.py +++ b/pipeline_plugins/components/query/sites/open/nodeman.py @@ -13,8 +13,8 @@ import logging import os -from django.conf.urls import url from django.http import JsonResponse +from django.urls import re_path from django.utils.translation import ugettext_lazy as _ from api.collections.nodeman import BKNodeManClient @@ -137,10 +137,10 @@ def nodeman_get_install_channel(request, cloud_id: int): nodeman_urlpatterns = [ - url(r"^nodeman_get_cloud_area/$", nodeman_get_cloud_area), - url(r"^nodeman_get_ap_list/$", nodeman_get_ap_list), - url(r"^nodeman_is_support_tjj/$", nodeman_is_support_tjj), - url(r"^nodeman_get_plugin_list/(?P\w+)/$", nodeman_get_plugin_list), - url(r"^nodeman_get_plugin_version/(?P[\w-]+)/(?P\w+)/$", nodeman_get_plugin_version), - url(r"^nodeman_get_install_channel/(?P\w+)/$", nodeman_get_install_channel), + re_path(r"^nodeman_get_cloud_area/$", nodeman_get_cloud_area), + re_path(r"^nodeman_get_ap_list/$", nodeman_get_ap_list), + re_path(r"^nodeman_is_support_tjj/$", nodeman_is_support_tjj), + re_path(r"^nodeman_get_plugin_list/(?P\w+)/$", nodeman_get_plugin_list), + re_path(r"^nodeman_get_plugin_version/(?P[\w-]+)/(?P\w+)/$", nodeman_get_plugin_version), + re_path(r"^nodeman_get_install_channel/(?P\w+)/$", nodeman_get_install_channel), ] diff --git a/pipeline_plugins/variables/query/sites/open/query.py b/pipeline_plugins/variables/query/sites/open/query.py index 4ad107a233..2ef5ad2bff 100644 --- a/pipeline_plugins/variables/query/sites/open/query.py +++ b/pipeline_plugins/variables/query/sites/open/query.py @@ -12,17 +12,17 @@ """ import logging -from django.conf.urls import url from django.http import JsonResponse +from django.urls import re_path from django.utils.translation import ugettext_lazy as _ +from api.utils.request import batch_request from gcloud.conf import settings from gcloud.core.models import StaffGroupSet -from api.utils.request import batch_request from gcloud.utils.handlers import handle_api_error from pipeline_plugins.base.utils.inject import supplier_account_inject from pipeline_plugins.variables.query.sites.open import select -from pipeline_plugins.variables.utils import get_service_template_list, get_set_list, get_biz_internal_module +from pipeline_plugins.variables.utils import get_biz_internal_module, get_service_template_list, get_set_list logger = logging.getLogger("root") @@ -196,12 +196,15 @@ def cc_get_set_env(request, obj_id, biz_cc_id, supplier_account): urlpatterns += [ - url(r"^cc_get_set_env/(?P\w+)/(?P\d+)/$", cc_get_set_env,), - url(r"^cc_get_set/(?P\d+)/$", cc_get_set), - url(r"^cc_get_module/(?P\d+)/(?P\d+)/$", cc_get_module), - url(r"^cc_get_set_list/(?P\d+)/$", cc_get_set_list), - url(r"^cc_get_service_template_list/(?P\d+)/$", cc_list_service_template), - url(r"^cc_get_set_group/(?P\d+)/$", cc_get_set_group), - url(r"^get_staff_groups/(?P\d+)/$", get_staff_groups), - url(r"^cc_get_set_attributes/(?P\d+)/$", cc_get_set_attribute), + re_path( + r"^cc_get_set_env/(?P\w+)/(?P\d+)/$", + cc_get_set_env, + ), + re_path(r"^cc_get_set/(?P\d+)/$", cc_get_set), + re_path(r"^cc_get_module/(?P\d+)/(?P\d+)/$", cc_get_module), + re_path(r"^cc_get_set_list/(?P\d+)/$", cc_get_set_list), + re_path(r"^cc_get_service_template_list/(?P\d+)/$", cc_list_service_template), + re_path(r"^cc_get_set_group/(?P\d+)/$", cc_get_set_group), + re_path(r"^get_staff_groups/(?P\d+)/$", get_staff_groups), + re_path(r"^cc_get_set_attributes/(?P\d+)/$", cc_get_set_attribute), ] diff --git a/pipeline_plugins/variables/query/sites/open/select.py b/pipeline_plugins/variables/query/sites/open/select.py index 1d94a3fbf4..c18ee6cd05 100644 --- a/pipeline_plugins/variables/query/sites/open/select.py +++ b/pipeline_plugins/variables/query/sites/open/select.py @@ -12,11 +12,11 @@ """ import logging -import requests +import requests from django.conf import settings -from django.conf.urls import url from django.http import JsonResponse +from django.urls import re_path from django.utils.translation import ugettext_lazy as _ logger = logging.getLogger("root") @@ -69,5 +69,5 @@ def variable_select_source_data_proxy(request): select_urlpatterns = [ - url(r"^variable_select_source_data_proxy/$", variable_select_source_data_proxy), + re_path(r"^variable_select_source_data_proxy/$", variable_select_source_data_proxy), ] diff --git a/plugin_service/README.md b/plugin_service/README.md index 50940eaba5..f31f78f8c7 100644 --- a/plugin_service/README.md +++ b/plugin_service/README.md @@ -22,7 +22,7 @@ INSTALLED_APPS += ( ``` python urlpatterns = [ ..., - url(r"^plugin_service/", include("plugin_service.urls")), + re_path(r"^plugin_service/", include("plugin_service.urls")), ..., ] ``` diff --git a/plugin_service/docs/openapi_config.md b/plugin_service/docs/openapi_config.md index 72abbd542d..6295c249e8 100644 --- a/plugin_service/docs/openapi_config.md +++ b/plugin_service/docs/openapi_config.md @@ -16,9 +16,9 @@ ) urlpatterns += [ - url(r"^swagger(?P\.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\.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"), ] ``` diff --git a/plugin_service/urls.py b/plugin_service/urls.py index 03481be2a7..c9296d9c8a 100644 --- a/plugin_service/urls.py +++ b/plugin_service/urls.py @@ -11,18 +11,17 @@ specific language governing permissions and limitations under the License. """ -from django.conf.urls import url +from django.urls import re_path from . import api - urlpatterns = [ - url(r"^list/$", api.get_plugin_list), - url(r"^detail_list/$", api.get_plugin_detail_list), - url(r"^tags/$", api.get_plugin_tags), - url(r"^meta/$", api.get_meta), - url(r"^detail/$", api.get_plugin_detail), - url(r"^logs/$", api.get_logs), - url(r"^app_detail/$", api.get_plugin_app_detail), - url(r"^data_api/(?P.+?)/(?P.+)$", api.get_plugin_api_data), + re_path(r"^list/$", api.get_plugin_list), + re_path(r"^detail_list/$", api.get_plugin_detail_list), + re_path(r"^tags/$", api.get_plugin_tags), + re_path(r"^meta/$", api.get_meta), + re_path(r"^detail/$", api.get_plugin_detail), + re_path(r"^logs/$", api.get_logs), + re_path(r"^app_detail/$", api.get_plugin_app_detail), + re_path(r"^data_api/(?P.+?)/(?P.+)$", api.get_plugin_api_data), ] diff --git a/urls.py b/urls.py index b044d1db26..5335902c42 100644 --- a/urls.py +++ b/urls.py @@ -26,17 +26,17 @@ """ from django.conf import settings -from django.conf.urls import include, url from django.contrib import admin +from django.urls import include, path, re_path from django.views import static from config.urls_custom import urlpatterns_custom from gcloud.core.views import page_not_found urlpatterns = [ - url(r"^django_admin/", admin.site.urls), - url(r"^account/", include("blueapps.account.urls")), - url(r"^notice/", include("bk_notice_sdk.urls")), + re_path(r"^django_admin/", admin.site.urls), + re_path(r"^account/", include("blueapps.account.urls")), + re_path(r"^notice/", include("bk_notice_sdk.urls")), ] # app自定义路径 @@ -45,12 +45,12 @@ if settings.IS_LOCAL: urlpatterns += [ # media - url(r"^media/(?P.*)$", static.serve, {"document_root": settings.MEDIA_ROOT}), - url("favicon.ico", static.serve, {"document_root": settings.STATIC_ROOT, "path": "core/images/bk_sops.png"}), + re_path(r"^media/(?P.*)$", static.serve, {"document_root": settings.MEDIA_ROOT}), + path("favicon.ico", static.serve, {"document_root": settings.STATIC_ROOT, "path": "core/images/bk_sops.png"}), ] if not settings.DEBUG: urlpatterns += [ - url(r"^static/(?P.*)$", static.serve, {"document_root": settings.STATIC_ROOT}), + re_path(r"^static/(?P.*)$", static.serve, {"document_root": settings.STATIC_ROOT}), ] handler404 = page_not_found diff --git a/weixin/core/urls.py b/weixin/core/urls.py index 1d71ef2ce9..a265068d70 100644 --- a/weixin/core/urls.py +++ b/weixin/core/urls.py @@ -11,11 +11,10 @@ specific language governing permissions and limitations under the License. """ -from django.conf.urls import url +from django.urls import re_path from . import views - urlpatterns = [ - url(r'^$', views.login, name='weixin_login'), + re_path(r"^$", views.login, name="weixin_login"), ] diff --git a/weixin/urls.py b/weixin/urls.py index 6bc6fa9e1d..424a9977ee 100644 --- a/weixin/urls.py +++ b/weixin/urls.py @@ -11,21 +11,22 @@ specific language governing permissions and limitations under the License. """ -from django.conf.urls import include, url +from django.urls import include, path, re_path from rest_framework.routers import DefaultRouter -from . import views from weixin.viewsets import ( - WxTaskTemplateViewSet, - WxTaskFlowInstanceViewSet, + WxCollectionViewSet, WxComponentModelSetViewSet, - WxWxVariableViewSet, + WxProjectViewSet, + WxTaskFlowInstanceViewSet, + WxTaskTemplateViewSet, WxTemplateSchemeViewSet, WxUserProjectViewSet, - WxProjectViewSet, - WxCollectionViewSet, + WxWxVariableViewSet, ) +from . import views + weixin_v3_drf_api = DefaultRouter() weixin_v3_drf_api.register("weixin_template", WxTaskTemplateViewSet) weixin_v3_drf_api.register("weixin_taskflow", WxTaskFlowInstanceViewSet) @@ -33,13 +34,13 @@ weixin_v3_drf_api.register("weixin_variable", WxWxVariableViewSet) weixin_v3_drf_api.register("weixin_scheme", WxTemplateSchemeViewSet) weixin_v3_drf_api.register("weixin_user_project", WxUserProjectViewSet) -weixin_v3_drf_api.register("weixin_project", WxProjectViewSet) +weixin_v3_drf_api.register("weixin_project", WxProjectViewSet, basename="weixin_project") weixin_v3_drf_api.register("weixin_collection", WxCollectionViewSet) urlpatterns = [ - url(r"^$", views.home), - url(r"^taskflow/", include("gcloud.taskflow3.urls")), - url(r"^template/", include("gcloud.tasktmpl3.urls")), - url(r"api/v3/", include(weixin_v3_drf_api.urls)), + re_path(r"^$", views.home), + re_path(r"^taskflow/", include("gcloud.taskflow3.urls")), + re_path(r"^template/", include("gcloud.tasktmpl3.urls")), + path(r"api/v3/", include(weixin_v3_drf_api.urls)), ]