From ac8b68b0e5154f020e23a162006ff6dd4a9933ad Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Fri, 15 Jun 2018 23:31:45 +0200 Subject: [PATCH] Remove OldMapUrl --- umap/tests/test_map_views.py | 12 ------------ umap/urls.py | 2 -- umap/views.py | 19 ------------------- 3 files changed, 33 deletions(-) diff --git a/umap/tests/test_map_views.py b/umap/tests/test_map_views.py index d602e975..26541c62 100644 --- a/umap/tests/test_map_views.py +++ b/umap/tests/test_map_views.py @@ -144,18 +144,6 @@ def test_short_url_should_redirect_to_canonical(client, map): assert response['Location'] == canonical -def test_old_url_should_redirect_to_canonical(client, map): - url = reverse( - 'map_old_url', - kwargs={'username': map.owner.username, 'slug': map.slug} - ) - canonical = reverse('map', kwargs={'pk': map.pk, - 'slug': map.slug}) - response = client.get(url) - assert response.status_code == 301 - assert response['Location'] == canonical - - def test_clone_map_should_create_a_new_instance(client, map): assert Map.objects.count() == 1 url = reverse('map_clone', kwargs={'map_id': map.pk}) diff --git a/umap/urls.py b/umap/urls.py index 71d02ae3..ff515024 100644 --- a/umap/urls.py +++ b/umap/urls.py @@ -42,8 +42,6 @@ i18n_urls = [ url(r'^logout/$', views.logout, name='logout'), url(r'^map/(?P\d+)/geojson/$', views.MapViewGeoJSON.as_view(), name='map_geojson'), - url(r'^map/(?P[-_\w]+)/(?P[-_\w]+)/$', - views.MapOldUrl.as_view(), name='map_old_url'), url(r'^map/anonymous-edit/(?P.+)$', views.MapAnonymousEditUrl.as_view(), name='map_anonymous_edit_url'), url(r'^pictogram/json/$', views.PictogramJSONList.as_view(), diff --git a/umap/views.py b/umap/views.py index 00fea2cc..849f9173 100644 --- a/umap/views.py +++ b/umap/views.py @@ -635,25 +635,6 @@ class MapShortUrl(RedirectView): return url -class MapOldUrl(RedirectView): - """ - Handle map URLs from before anonymous allowing. - """ - query_string = True - permanent = True - - def get_redirect_url(self, **kwargs): - owner = get_object_or_404(User, username=self.kwargs['username']) - map_inst = get_object_or_404(Map, slug=self.kwargs['slug'], - owner=owner) - url = map_inst.get_absolute_url() - if self.query_string: - args = self.request.META.get('QUERY_STRING', '') - if args: - url = "%s?%s" % (url, args) - return url - - class MapAnonymousEditUrl(RedirectView): permanent = False