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

chore: remove deprecated functions url and ugettext_lazy #3976

Merged
merged 3 commits into from
May 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 6 additions & 4 deletions api/api/urls/deprecated.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.conf.urls import url
from django.urls import re_path

from environments.identities.traits.views import SDKTraitsDeprecated
from environments.identities.views import SDKIdentitiesDeprecated
Expand All @@ -7,10 +7,12 @@
app_name = "deprecated"

urlpatterns = [
url(
re_path(
r"^identities/(?P<identifier>[-\w@%.]+)/traits/(?P<trait_key>[-\w.]+)$",
SDKTraitsDeprecated.as_view(),
),
url(r"^identities/(?P<identifier>[-\w@%.]+)/", SDKIdentitiesDeprecated.as_view()),
url(r"^flags/(?P<identifier>[-\w@%.]+)$", SDKFeatureStates.as_view()),
re_path(
r"^identities/(?P<identifier>[-\w@%.]+)/", SDKIdentitiesDeprecated.as_view()
),
re_path(r"^flags/(?P<identifier>[-\w@%.]+)$", SDKFeatureStates.as_view()),
]
58 changes: 28 additions & 30 deletions api/api/urls/v1.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from app_analytics.views import SDKAnalyticsFlags, SelfHostedTelemetryAPIView
from django.conf import settings
from django.conf.urls import url
from django.urls import include, path
from django.urls import include, path, re_path
from drf_yasg import openapi
from drf_yasg.views import get_schema_view
from rest_framework import authentication, permissions, routers
Expand Down Expand Up @@ -32,44 +31,43 @@
app_name = "v1"

urlpatterns = [
url(r"^organisations/", include("organisations.urls"), name="organisations"),
url(r"^projects/", include("projects.urls"), name="projects"),
url(r"^environments/", include("environments.urls"), name="environments"),
url(r"^features/", include("features.urls"), name="features"),
url(r"^multivariate/", include("features.multivariate.urls"), name="multivariate"),
url(r"^segments/", include("segments.urls"), name="segments"),
url(r"^users/", include("users.urls")),
url(r"^e2etests/", include("e2etests.urls")),
url(r"^audit/", include("audit.urls")),
url(r"^auth/", include("custom_auth.urls")),
url(r"^metadata/", include("metadata.urls")),
re_path(r"^organisations/", include("organisations.urls"), name="organisations"),
re_path(r"^projects/", include("projects.urls"), name="projects"),
re_path(r"^environments/", include("environments.urls"), name="environments"),
re_path(r"^features/", include("features.urls"), name="features"),
re_path(
r"^multivariate/", include("features.multivariate.urls"), name="multivariate"
),
re_path(r"^segments/", include("segments.urls"), name="segments"),
re_path(r"^users/", include("users.urls")),
re_path(r"^e2etests/", include("e2etests.urls")),
re_path(r"^audit/", include("audit.urls")),
re_path(r"^auth/", include("custom_auth.urls")),
re_path(r"^metadata/", include("metadata.urls")),
# Chargebee webhooks
url(r"cb-webhook/", chargebee_webhook, name="chargebee-webhook"),
re_path(r"cb-webhook/", chargebee_webhook, name="chargebee-webhook"),
# GitHub integration webhook
url(r"github-webhook/", github_webhook, name="github-webhook"),
re_path(r"github-webhook/", github_webhook, name="github-webhook"),
re_path(r"cb-webhook/", chargebee_webhook, name="chargebee-webhook"),
# Client SDK urls
url(r"^flags/$", SDKFeatureStates.as_view(), name="flags"),
url(r"^identities/$", SDKIdentities.as_view(), name="sdk-identities"),
url(r"^traits/", include(traits_router.urls), name="traits"),
url(r"^analytics/flags/$", SDKAnalyticsFlags.as_view(), name="analytics-flags"),
url(
r"^analytics/telemetry/$",
SelfHostedTelemetryAPIView.as_view(),
name="analytics-telemetry",
),
url(
re_path(r"^flags/$", SDKFeatureStates.as_view(), name="flags"),
re_path(r"^identities/$", SDKIdentities.as_view(), name="sdk-identities"),
re_path(r"^traits/", include(traits_router.urls), name="traits"),
re_path(r"^analytics/flags/$", SDKAnalyticsFlags.as_view(), name="analytics-flags"),
re_path(r"^analytics/telemetry/$", SelfHostedTelemetryAPIView.as_view()),
re_path(
r"^environment-document/$",
SDKEnvironmentAPIView.as_view(),
name="environment-document",
),
url("", include("features.versioning.urls", namespace="versioning")),
re_path("", include("features.versioning.urls", namespace="versioning")),
# API documentation
url(
re_path(
r"^swagger(?P<format>\.json|\.yaml)$",
schema_view.without_ui(cache_timeout=0),
name="schema-json",
),
url(
re_path(
r"^docs/$",
schema_view.with_ui("swagger", cache_timeout=0),
name="schema-swagger-ui",
Expand All @@ -87,10 +85,10 @@
split_testing_router.register(r"", SplitTestViewSet, basename="split-tests")

urlpatterns += [
url(
re_path(
r"^split-testing/", include(split_testing_router.urls), name="split-testing"
),
url(
re_path(
r"^split-testing/conversion-events/",
CreateConversionEventView.as_view(),
name="conversion-events",
Expand Down
6 changes: 4 additions & 2 deletions api/api/urls/v2.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from app_analytics.views import SDKAnalyticsFlagsV2
from django.conf.urls import url
from django.urls import re_path

app_name = "v2"

urlpatterns = [
url(r"^analytics/flags/$", SDKAnalyticsFlagsV2.as_view(), name="analytics-flags")
re_path(
r"^analytics/flags/$", SDKAnalyticsFlagsV2.as_view(), name="analytics-flags"
)
]
25 changes: 12 additions & 13 deletions api/app/urls.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
import importlib

from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.urls import path
from django.urls import include, path, re_path
from django.views.generic.base import TemplateView

from users.views import password_reset_redirect

from . import views

urlpatterns = [
url(r"^api/v1/", include("api.urls.deprecated", namespace="api-deprecated")),
url(r"^api/v1/", include("api.urls.v1", namespace="api-v1")),
url(r"^api/v2/", include("api.urls.v2", namespace="api-v2")),
url(r"^admin/", admin.site.urls),
url(r"^health", include("health_check.urls", namespace="health")),
url(r"^version", views.version_info, name="version-info"),
url(
re_path(r"^api/v1/", include("api.urls.deprecated", namespace="api-deprecated")),
re_path(r"^api/v1/", include("api.urls.v1", namespace="api-v1")),
re_path(r"^api/v2/", include("api.urls.v2", namespace="api-v2")),
re_path(r"^admin/", admin.site.urls),
re_path(r"^health", include("health_check.urls", namespace="health")),
re_path(r"^version", views.version_info, name="version-info"),
re_path(
r"^sales-dashboard/",
include("sales_dashboard.urls", namespace="sales_dashboard"),
),
# this url is used to generate email content for the password reset workflow
url(
re_path(
r"^password-reset/confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,"
r"13}-[0-9A-Za-z]{1,20})/$",
password_reset_redirect,
name="password_reset_confirm",
),
url(
re_path(
r"^config/project-overrides",
views.project_overrides,
name="project_overrides",
Expand All @@ -44,7 +43,7 @@
import debug_toolbar

urlpatterns = [
url(r"^__debug__/", include(debug_toolbar.urls)),
re_path(r"^__debug__/", include(debug_toolbar.urls)),
] + urlpatterns

if settings.SAML_INSTALLED:
Expand All @@ -70,4 +69,4 @@

if settings.SERVE_FE_ASSETS:
gagantrivedi marked this conversation as resolved.
Show resolved Hide resolved
# add route to serve FE assets for any unrecognised paths
urlpatterns.append(url(r"^.*$", views.index, name="index"))
urlpatterns.append(re_path(r"^.*$", views.index, name="index"))

Check warning on line 72 in api/app/urls.py

View check run for this annotation

Codecov / codecov/patch

api/app/urls.py#L72

Added line #L72 was not covered by tests
4 changes: 2 additions & 2 deletions api/audit/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.conf.urls import include, url
from django.urls import include, re_path
from rest_framework import routers

from audit.views import AllAuditLogViewSet
Expand All @@ -7,4 +7,4 @@
router.register(r"", AllAuditLogViewSet, basename="audit")


urlpatterns = [url(r"^", include(router.urls))]
urlpatterns = [re_path(r"^", include(router.urls))]
4 changes: 2 additions & 2 deletions api/e2etests/urls.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from django.conf.urls import url
from django.urls import re_path

from .views import Teardown

app_name = "e2etests"


urlpatterns = [
url(r"teardown/", Teardown.as_view(), name="teardown"),
re_path(r"teardown/", Teardown.as_view(), name="teardown"),
]
2 changes: 1 addition & 1 deletion api/environments/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from django.db import models
from django.db.models import Prefetch, Q
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
matthewelwell marked this conversation as resolved.
Show resolved Hide resolved
from django_lifecycle import (
AFTER_CREATE,
AFTER_DELETE,
Expand Down
11 changes: 5 additions & 6 deletions api/environments/urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django.conf.urls import include, url
from django.urls import path
from django.urls import include, path, re_path
from rest_framework_nested import routers

from edge_api.identities.views import (
Expand Down Expand Up @@ -129,10 +128,10 @@
app_name = "environments"

urlpatterns = [
url(r"^", include(router.urls)),
url(r"^", include(environments_router.urls)),
url(r"^", include(identity_router.urls)),
url(r"^", include(edge_identity_router.urls)),
re_path(r"^", include(router.urls)),
re_path(r"^", include(environments_router.urls)),
re_path(r"^", include(identity_router.urls)),
re_path(r"^", include(edge_identity_router.urls)),
path(
"environments/<str:environment_api_key>/edge-identities-featurestates",
EdgeIdentityWithIdentifierFeatureStateView.as_view(),
Expand Down
2 changes: 1 addition & 1 deletion api/features/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from django.db import models
from django.db.models import Max, Q, QuerySet
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
matthewelwell marked this conversation as resolved.
Show resolved Hide resolved
from django_lifecycle import (
AFTER_CREATE,
AFTER_SAVE,
Expand Down
19 changes: 9 additions & 10 deletions api/organisations/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
get_usage_data_view,
)
from django.conf import settings
from django.conf.urls import include, url
from django.urls import path
from django.urls import include, path, re_path
from rest_framework_nested import routers

from api_keys.views import MasterAPIKeyViewSet
Expand Down Expand Up @@ -97,9 +96,9 @@


urlpatterns = [
url(r"^", include(router.urls)),
url(r"^", include(organisations_router.urls)),
url(r"^", include(nested_github_router.urls)),
re_path(r"^", include(router.urls)),
re_path(r"^", include(organisations_router.urls)),
re_path(r"^", include(nested_github_router.urls)),
path(
"<int:organisation_pk>/usage-data/",
get_usage_data_view,
Expand Down Expand Up @@ -211,10 +210,10 @@
)
urlpatterns.extend(
[
url(r"^", include(organisations_router.urls)),
url(r"^", include(nested_roles_router.urls)),
url(r"^", include(nested_user_roles_routes.urls)),
url(r"^", include(nested_api_key_roles_routes.urls)),
url(r"^", include(nested_group_roles_routes.urls)),
re_path(r"^", include(organisations_router.urls)),
re_path(r"^", include(nested_roles_router.urls)),
re_path(r"^", include(nested_user_roles_routes.urls)),
re_path(r"^", include(nested_api_key_roles_routes.urls)),
re_path(r"^", include(nested_group_roles_routes.urls)),
]
)
9 changes: 4 additions & 5 deletions api/projects/urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django.conf.urls import include, url
from django.urls import path
from django.urls import include, path, re_path
from rest_framework_nested import routers

from audit.views import ProjectAuditLogViewSet
Expand Down Expand Up @@ -78,9 +77,9 @@
app_name = "projects"

urlpatterns = [
url(r"^", include(router.urls)),
url(r"^", include(projects_router.urls)),
url(r"^", include(nested_features_router.urls)),
re_path(r"^", include(router.urls)),
re_path(r"^", include(projects_router.urls)),
re_path(r"^", include(nested_features_router.urls)),
path(
"<int:project_pk>/all-user-permissions/<int:user_pk>/",
get_user_project_permissions,
Expand Down
5 changes: 2 additions & 3 deletions api/users/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from django.conf import settings
from django.conf.urls import url
from django.urls import path
from django.urls import path, re_path

from organisations.invites.views import (
join_organisation_from_email,
Expand All @@ -24,4 +23,4 @@
]

if settings.ALLOW_ADMIN_INITIATION_VIA_URL:
gagantrivedi marked this conversation as resolved.
Show resolved Hide resolved
urlpatterns.insert(0, url(r"^init/", AdminInitView.as_view()))
urlpatterns.insert(0, re_path(r"^init/", AdminInitView.as_view()))