0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-29 17:36:49 +01:00

Fix WAGTAILFRONTENDCACHE_LANGUAGES (#6290)

This commit is contained in:
Karl Hobley 2020-08-04 15:53:23 +01:00 committed by GitHub
parent c9375ddf01
commit 10c8d66423
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

View File

@ -300,15 +300,20 @@ class TestCachePurgingSignals(TestCase):
@override_settings(ROOT_URLCONF='wagtail.tests.urls_multilang',
LANGUAGE_CODE='en',
WAGTAILFRONTENDCACHE_LANGUAGES=['en'])
WAGTAILFRONTENDCACHE_LANGUAGES=['en', 'fr', 'pt-br'])
def test_purge_on_publish_in_multilang_env(self):
from django.conf import settings
PURGED_URLS[:] = [] # reset PURGED_URLS to the empty list
page = EventIndex.objects.get(url_path='/home/events/')
page.save_revision().publish()
self.assertEqual(len(PURGED_URLS), len(settings.WAGTAILFRONTENDCACHE_LANGUAGES) * 2)
for isocode, description in settings.WAGTAILFRONTENDCACHE_LANGUAGES:
self.assertIn('http://localhost/%s/events/' % isocode, PURGED_URLS)
self.assertEqual(PURGED_URLS, [
'http://localhost/en/events/',
'http://localhost/en/events/past/',
'http://localhost/fr/events/',
'http://localhost/fr/events/past/',
'http://localhost/pt-br/events/',
'http://localhost/pt-br/events/past/',
])
class TestPurgeBatchClass(TestCase):

View File

@ -69,7 +69,7 @@ def purge_urls_from_cache(urls, backend_settings=None, backends=None):
new_urls = []
# Purge the given url for each managed language
for isocode, description in languages:
for isocode in languages:
for url in urls:
up = urlparse(url)
new_url = urlunparse((