Skip to content

Commit 790bc31

Browse files
stevejalimclaude
andauthored
Remove contentful from the codebase (#16960)
* Remove Contentful usage from Products app - Replace Contentful-based active_locale_available() with Wagtail query - Remove resource center view functions and URL patterns - Remove Contentful imports and unused helper functions - Keep vpn_resource_center_redirect() for backward compatibility - Fix circular import by moving model import inside function 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]> * Remove Contentful usage from Firefox app - Remove ContentfulPage import - Delete FirefoxContentful view class - Remove Contentful URL pattern - Remove unused settings import 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]> * Remove Contentful usage from Mozorg app - Remove ContentfulPage import - Delete ContentfulPreviewView class - Delete dev_urls.py file (only contained Contentful preview URL) - Remove dev_urls import and usage from mozorg/urls.py - Remove unused imports (method_decorator, never_cache, settings) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]> * Remove Contentful from Base views - Remove ContentfulEntry import - Delete get_contentful_sync_info() function - Remove contentful_info from cron-health-check context - Remove unused tz_now import 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]> * Remove Contentful from Sitemaps - Remove Contentful imports - Delete _get_vrc_urls() and get_contentful_urls() functions - Remove get_contentful_urls() call from get_all_urls() 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]> * Clean up Contentful test files - Delete all contentful/tests/ files - Delete mozorg/tests/contentful_test_urlconf.py - Remove Contentful imports and tests from base/tests/test_views.py - Remove Contentful test classes from products/tests/test_views.py - Remove Contentful tests and mocking from sitemaps/tests/test_utils.py 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]> * Remove Contentful configuration from settings - Remove bedrock.contentful.constants import - Remove bedrock.contentful from INSTALLED_APPS - Delete all CONTENTFUL_* settings 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]> * Remove contentful third-party dependency - Remove contentful==2.5.0 from requirements/prod.in - Regenerate requirements/prod.txt 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]> * Delete Contentful Django app Remove entire bedrock/contentful/ directory including: - models, views, API code, utilities - management commands - migrations (database tables will remain for later cleanup) - templates and templatetags - all other files and subdirectories 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]> * Update database scripts to remove Contentful references - Remove contentful.ContentfulEntry from export-db-to-sqlite.sh - Remove Contentful data import/export section from fill-empty-postgres-database.sh 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]> * Clean up remaining Contentful references - Delete contentful-all.html templates from mozorg and firefox - Remove Contentful sync info from cron-health-check.html - Delete test_contentful_preview_view test from mozorg/tests - Remove unused imports (Mock, pytest) from mozorg/tests/test_views.py 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]> * Remove Contentful CSS bundles and files - Remove 15 Contentful-related bundle definitions from static-bundles.json - Delete all CSS files in media/css/contentful/ directory - Remove bundle definitions: mozilla-c-article, mozilla-c-call-out, mozilla-c-picto, mozilla-c-section-heading, mozilla-c-split, mozilla-c-card, mozilla-t-multi-column, firefox-c-article, firefox-c-call-out, firefox-c-picto, firefox-c-section-heading, firefox-c-split, c-logo, firefox-c-card, firefox-t-multi-column 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]> * Add VPN Resource Center URLs to cms_only_urls Add URL patterns for VPN Resource Center pages that are now CMS-only: - products.vpn.resource-center.landing - products.vpn.resource-center.article These were previously in products/urls.py with prefer_cms() decorator but removed when Contentful views were deleted. Adding them here allows reverse URL lookups to work while pages are served by the CMS. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]> * Remove remaining Contentful references from config files - Remove contentful per-file-ignores from pyproject.toml - Remove contentful module from example_sentry_payload.json - Remove contentful_migrations ignore pattern from eslint.config.js 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]> * Add in redirects from old-old VPN info content --------- Co-authored-by: Claude Sonnet 4.5 <[email protected]>
1 parent 1e58aa8 commit 790bc31

File tree

78 files changed

+25
-6726
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+25
-6726
lines changed

bedrock/base/templates/cron-health-check.html

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,6 @@ <h1 id="other-data">Other Site Data</h1>
8989
<td>{{ most_recent_data_change_ts }}</td>
9090
</tr>
9191
{% endif %}
92-
<tr>
93-
<td><b>Latest Contentful sync</b></td>
94-
<td{% if contentful_info.latest_sync %} title="{{contentful_info.latest_sync|datetime(settings.STRFTIME_FORMAT_INTERNAL_USE)}}"{% endif %}>
95-
{% if contentful_info.time_since_latest_sync %}
96-
{{ contentful_info.time_since_latest_sync }}
97-
{% else %}
98-
No data!
99-
{% endif %}
100-
</td>
101-
</tr>
10292
</tbody>
10393
</table>
10494

bedrock/base/tests/data/example_sentry_payload.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@
232232
"click": "8.0.4",
233233
"commonware": "0.6.0",
234234
"compare-locales": "7.6.0",
235-
"contentful": "1.13.1",
236235
"contextlib2": "0.5.4",
237236
"coverage": "6.3.2",
238237
"cryptography": "36.0.1",

bedrock/base/tests/test_views.py

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@
22
# License, v. 2.0. If a copy of the MPL was not distributed with this
33
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
44

5-
import datetime
65
from unittest.mock import patch
76

87
from django.conf import settings
98
from django.test import RequestFactory, TestCase
10-
from django.utils.timezone import now as tz_now
119

1210
import pytest
1311

14-
from bedrock.base.views import GeoTemplateView, get_contentful_sync_info, page_gone_view, page_not_found_view, server_error_view
15-
from bedrock.contentful.models import ContentfulEntry
12+
from bedrock.base.views import GeoTemplateView, page_gone_view, page_not_found_view, server_error_view
1613

1714
geo_template_view = GeoTemplateView.as_view(
1815
geo_template_names={
@@ -76,36 +73,6 @@ def test_500_handler(self):
7673
self.check_error_handler(server_error_view, "500.html", 500)
7774

7875

79-
@patch("bedrock.base.views.tz_now")
80-
@patch("bedrock.base.views.timeago.format")
81-
@pytest.mark.django_db
82-
def test_get_contentful_sync_info(mock_timeago_format, mock_tz_now):
83-
mock_timeago_format.return_value = "mock-formatted-time-delta"
84-
_now = datetime.datetime.utcnow().replace(tzinfo=datetime.UTC)
85-
mock_tz_now.return_value = _now
86-
87-
middle = tz_now()
88-
first = middle - datetime.timedelta(hours=3)
89-
last = middle + datetime.timedelta(hours=3)
90-
91-
for idx, timestamp in enumerate([middle, last, first]):
92-
ContentfulEntry.objects.create(
93-
contentful_id=f"id-{idx}",
94-
last_modified=timestamp,
95-
)
96-
97-
assert get_contentful_sync_info() == {
98-
"latest_sync": last,
99-
"time_since_latest_sync": "mock-formatted-time-delta",
100-
}
101-
102-
mock_timeago_format.assert_called_once_with(last, now=_now)
103-
104-
# Also check the no-data context dict:
105-
ContentfulEntry.objects.all().delete()
106-
assert get_contentful_sync_info() == {}
107-
108-
10976
@pytest.mark.django_db
11077
def test_csrf_view_is_custom_one():
11178
assert settings.CSRF_FAILURE_VIEW == "bedrock.base.views.csrf_failure"

bedrock/base/views.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from django.conf import settings
1212
from django.shortcuts import render
1313
from django.utils.decorators import decorator_from_middleware
14-
from django.utils.timezone import now as tz_now
1514
from django.views.decorators.cache import never_cache
1615
from django.views.decorators.http import require_safe
1716

@@ -21,7 +20,6 @@
2120
from bedrock.base.geo import get_country_from_request
2221
from bedrock.base.i18n import get_language_from_headers
2322
from bedrock.base.middleware import BedrockLocaleMiddleware
24-
from bedrock.contentful.models import ContentfulEntry
2523
from bedrock.utils import git
2624
from lib import l10n_utils
2725

@@ -108,24 +106,6 @@ def get_extra_server_info():
108106
return server_info
109107

110108

111-
def get_contentful_sync_info():
112-
data = {}
113-
latest = ContentfulEntry.objects.order_by("last_modified").last()
114-
if latest:
115-
latest_sync = latest.last_modified
116-
time_since_latest_sync = timeago.format(
117-
latest_sync,
118-
now=tz_now(),
119-
)
120-
data.update(
121-
{
122-
"latest_sync": latest_sync,
123-
"time_since_latest_sync": time_since_latest_sync,
124-
}
125-
)
126-
return data
127-
128-
129109
@require_safe
130110
@never_cache
131111
def cron_health_check(request):
@@ -172,7 +152,6 @@ def cron_health_check(request):
172152
{
173153
"results": results,
174154
"server_info": get_extra_server_info(),
175-
"contentful_info": get_contentful_sync_info(),
176155
"success": check_pass,
177156
"git_repos": unique_repos.values(),
178157
"fluent_repo": get_l10n_repo_info(),

bedrock/cms/cms_only_urls.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,7 @@ def dummy_view(*args, **kwargs):
3333
# path("url/path/here/", dummy_view, name="route.name.here"),
3434
path("about/leadership/", dummy_view, name="mozorg.about.leadership.index"),
3535
path("products/monitor/", dummy_view, name="products.monitor.landing"),
36+
path("products/vpn/resource-center/", dummy_view, name="products.vpn.resource-center.landing"),
37+
path("products/vpn/resource-center/<slug:slug>/", dummy_view, name="products.vpn.resource-center.article"),
3638
path("advertising/", dummy_view, name="mozorg.advertising.landing"),
3739
)

bedrock/contentful/__init__.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)