Skip to content

Proxito: remove old implementation #10660

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

Merged
merged 15 commits into from
Aug 28, 2023
1 change: 0 additions & 1 deletion readthedocs/api/v2/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class Meta:
"documentation_type",
"users",
"canonical_url",
"urlconf",
"custom_prefix",
)

Expand Down
35 changes: 0 additions & 35 deletions readthedocs/core/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def base_resolve_path(
project_relationship=None,
subdomain=None,
cname=None,
urlconf=None,
custom_prefix=None,
):
"""
Expand Down Expand Up @@ -97,38 +96,6 @@ def base_resolve_path(
else:
path = unsafe_join_url_path(path, "{language}/{version}/{filename}")

# TODO: remove this when all projects have migrated to path prefixes.
# Allow users to override their own URLConf
# If a custom prefix is given, we don't use the custom URLConf,
# since they are not compatible with each other.
# We also don't check if the project has the new proxito implementation
# enabled, this is so we can start generating links with the new
# custom prefixes without starting to serve docs with it (this helps to ease
# the migration from urlconf to custom prefixes).
if urlconf and not custom_prefix:
path = urlconf
path = path.replace(
"$version",
"{version}",
)
path = path.replace(
'$language',
'{language}',
)
path = path.replace(
'$filename',
'{filename}',
)
path = path.replace(
"$subproject",
"{subproject}",
)
if "$" in path:
log.warning(
"Unconverted variable in a resolver URLConf.",
path=path,
)

subproject_alias = project_relationship.alias if project_relationship else ""
return path.format(
project=project_slug,
Expand All @@ -147,7 +114,6 @@ def resolve_path(
single_version=None,
subdomain=None,
cname=None,
urlconf=None,
):
"""Resolve a URL with a subset of fields defined."""
version_slug = version_slug or project.get_default_version()
Expand Down Expand Up @@ -181,7 +147,6 @@ def resolve_path(
project_relationship=project_relationship,
cname=cname,
subdomain=subdomain,
urlconf=urlconf or project.urlconf,
custom_prefix=custom_prefix,
)

Expand Down
2 changes: 2 additions & 0 deletions readthedocs/core/unresolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ def unresolve_path(self, unresolved_domain, path, append_indexhtml=True):
:param append_indexhtml: If `True` directories will be normalized
to end with ``/index.html``.
"""
# Make sure we always have a leading slash.
path = self._normalize_filename(path)
# We don't call unparse() on the path,
# since it could be parsed as a full URL if it starts with a protocol.
parsed_url = ParseResult(
Expand Down
17 changes: 0 additions & 17 deletions readthedocs/projects/fixtures/test_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"default_branch": null,
"requirements_file": null,
"documentation_type": "sphinx",
"urlconf": null,
"external_builds_enabled": false,
"external_builds_privacy_level": "public",
"cdn_enabled": false,
Expand Down Expand Up @@ -70,7 +69,6 @@
"default_branch": null,
"requirements_file": null,
"documentation_type": "sphinx",
"urlconf": null,
"external_builds_enabled": false,
"external_builds_privacy_level": "public",
"cdn_enabled": false,
Expand Down Expand Up @@ -123,7 +121,6 @@
"default_branch": null,
"requirements_file": null,
"documentation_type": "sphinx",
"urlconf": null,
"external_builds_enabled": false,
"external_builds_privacy_level": "public",
"cdn_enabled": false,
Expand Down Expand Up @@ -176,7 +173,6 @@
"default_branch": null,
"requirements_file": null,
"documentation_type": "sphinx",
"urlconf": null,
"external_builds_enabled": false,
"external_builds_privacy_level": "public",
"cdn_enabled": false,
Expand Down Expand Up @@ -229,7 +225,6 @@
"default_branch": null,
"requirements_file": null,
"documentation_type": "sphinx",
"urlconf": null,
"external_builds_enabled": false,
"external_builds_privacy_level": "public",
"cdn_enabled": false,
Expand Down Expand Up @@ -282,7 +277,6 @@
"default_branch": null,
"requirements_file": null,
"documentation_type": "sphinx",
"urlconf": null,
"external_builds_enabled": false,
"external_builds_privacy_level": "public",
"cdn_enabled": false,
Expand Down Expand Up @@ -335,7 +329,6 @@
"default_branch": null,
"requirements_file": null,
"documentation_type": "sphinx",
"urlconf": null,
"external_builds_enabled": false,
"external_builds_privacy_level": "public",
"cdn_enabled": false,
Expand Down Expand Up @@ -388,7 +381,6 @@
"default_branch": null,
"requirements_file": null,
"documentation_type": "sphinx",
"urlconf": null,
"external_builds_enabled": false,
"external_builds_privacy_level": "public",
"cdn_enabled": false,
Expand Down Expand Up @@ -441,7 +433,6 @@
"default_branch": null,
"requirements_file": null,
"documentation_type": "sphinx",
"urlconf": null,
"external_builds_enabled": false,
"external_builds_privacy_level": "public",
"cdn_enabled": false,
Expand Down Expand Up @@ -494,7 +485,6 @@
"default_branch": null,
"requirements_file": null,
"documentation_type": "sphinx",
"urlconf": null,
"external_builds_enabled": false,
"external_builds_privacy_level": "public",
"cdn_enabled": false,
Expand Down Expand Up @@ -547,7 +537,6 @@
"default_branch": null,
"requirements_file": null,
"documentation_type": "sphinx",
"urlconf": null,
"external_builds_enabled": false,
"external_builds_privacy_level": "public",
"cdn_enabled": false,
Expand Down Expand Up @@ -600,7 +589,6 @@
"default_branch": null,
"requirements_file": null,
"documentation_type": "sphinx",
"urlconf": null,
"external_builds_enabled": false,
"external_builds_privacy_level": "public",
"cdn_enabled": false,
Expand Down Expand Up @@ -653,7 +641,6 @@
"default_branch": null,
"requirements_file": null,
"documentation_type": "sphinx",
"urlconf": null,
"external_builds_enabled": false,
"external_builds_privacy_level": "public",
"cdn_enabled": false,
Expand Down Expand Up @@ -706,7 +693,6 @@
"default_branch": null,
"requirements_file": null,
"documentation_type": "sphinx",
"urlconf": null,
"external_builds_enabled": false,
"external_builds_privacy_level": "public",
"cdn_enabled": false,
Expand Down Expand Up @@ -757,7 +743,6 @@
"default_branch": null,
"requirements_file": null,
"documentation_type": "sphinx",
"urlconf": null,
"external_builds_enabled": false,
"external_builds_privacy_level": "public",
"cdn_enabled": false,
Expand Down Expand Up @@ -808,7 +793,6 @@
"default_branch": null,
"requirements_file": null,
"documentation_type": "sphinx",
"urlconf": null,
"external_builds_enabled": false,
"external_builds_privacy_level": "public",
"cdn_enabled": false,
Expand Down Expand Up @@ -859,7 +843,6 @@
"default_branch": null,
"requirements_file": null,
"documentation_type": "sphinx",
"urlconf": null,
"external_builds_enabled": false,
"external_builds_privacy_level": "public",
"cdn_enabled": false,
Expand Down
20 changes: 20 additions & 0 deletions readthedocs/projects/migrations/0105_remove_project_urlconf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 4.2.4 on 2023-08-23 20:35

from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("projects", "0104_alter_httpheader_value"),
]

operations = [
migrations.RemoveField(
model_name="historicalproject",
name="urlconf",
),
migrations.RemoveField(
model_name="project",
name="urlconf",
),
Comment on lines +16 to +19
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't deploy break if we remove this field? I assume the current production code is not using this field.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to run this migration after we have deployed the code.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK! Make sure to make this pretty clear on the release project. We usually run migrations before deploying new code.

]
Loading