Remove OldMapUrl
This commit is contained in:
parent
48185650b0
commit
ac8b68b0e5
3 changed files with 0 additions and 33 deletions
|
@ -144,18 +144,6 @@ def test_short_url_should_redirect_to_canonical(client, map):
|
||||||
assert response['Location'] == canonical
|
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):
|
def test_clone_map_should_create_a_new_instance(client, map):
|
||||||
assert Map.objects.count() == 1
|
assert Map.objects.count() == 1
|
||||||
url = reverse('map_clone', kwargs={'map_id': map.pk})
|
url = reverse('map_clone', kwargs={'map_id': map.pk})
|
||||||
|
|
|
@ -42,8 +42,6 @@ i18n_urls = [
|
||||||
url(r'^logout/$', views.logout, name='logout'),
|
url(r'^logout/$', views.logout, name='logout'),
|
||||||
url(r'^map/(?P<pk>\d+)/geojson/$', views.MapViewGeoJSON.as_view(),
|
url(r'^map/(?P<pk>\d+)/geojson/$', views.MapViewGeoJSON.as_view(),
|
||||||
name='map_geojson'),
|
name='map_geojson'),
|
||||||
url(r'^map/(?P<username>[-_\w]+)/(?P<slug>[-_\w]+)/$',
|
|
||||||
views.MapOldUrl.as_view(), name='map_old_url'),
|
|
||||||
url(r'^map/anonymous-edit/(?P<signature>.+)$',
|
url(r'^map/anonymous-edit/(?P<signature>.+)$',
|
||||||
views.MapAnonymousEditUrl.as_view(), name='map_anonymous_edit_url'),
|
views.MapAnonymousEditUrl.as_view(), name='map_anonymous_edit_url'),
|
||||||
url(r'^pictogram/json/$', views.PictogramJSONList.as_view(),
|
url(r'^pictogram/json/$', views.PictogramJSONList.as_view(),
|
||||||
|
|
|
@ -635,25 +635,6 @@ class MapShortUrl(RedirectView):
|
||||||
return url
|
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):
|
class MapAnonymousEditUrl(RedirectView):
|
||||||
|
|
||||||
permanent = False
|
permanent = False
|
||||||
|
|
Loading…
Reference in a new issue