summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2013-12-07 19:28:01 +0100
committerClaude Paroz <claude@2xlibre.net>2013-12-07 21:46:03 +0100
commit5c61b8519d8ce02e4308201f3e81fdc99ad80b58 (patch)
tree82de0403343dc52e1acaab961bc09296e8475d11 /django
parenta7cf48a2b7878bf98879f2963ab9a7d0e6493d9a (diff)
Fixed #18531 -- Deprecated Geo Sitemaps
I've chosen a quick deprecation path, as Geo Sitemaps themselves are deprecated from some time now.
Diffstat (limited to 'django')
-rw-r--r--django/contrib/gis/sitemaps/views.py6
-rw-r--r--django/contrib/gis/tests/geoapp/test_sitemaps.py5
2 files changed, 10 insertions, 1 deletions
diff --git a/django/contrib/gis/sitemaps/views.py b/django/contrib/gis/sitemaps/views.py
index c4c08de8f5..0672b800cc 100644
--- a/django/contrib/gis/sitemaps/views.py
+++ b/django/contrib/gis/sitemaps/views.py
@@ -1,5 +1,7 @@
from __future__ import unicode_literals
+import warnings
+
from django.http import HttpResponse, Http404
from django.template import loader
from django.contrib.sites.models import get_current_site
@@ -20,6 +22,8 @@ def index(request, sitemaps):
This view generates a sitemap index that uses the proper view
for resolving geographic section sitemap URLs.
"""
+ warnings.warn("Geo Sitemaps are deprecated. Use plain sitemaps from "
+ "django.contrib.sitemaps instead", DeprecationWarning, stacklevel=2)
current_site = get_current_site(request)
sites = []
protocol = request.scheme
@@ -43,6 +47,8 @@ def sitemap(request, sitemaps, section=None):
This view generates a sitemap with additional geographic
elements defined by Google.
"""
+ warnings.warn("Geo Sitemaps are deprecated. Use plain sitemaps from "
+ "django.contrib.sitemaps instead", DeprecationWarning, stacklevel=2)
maps, urls = [], []
if section is not None:
if section not in sitemaps:
diff --git a/django/contrib/gis/tests/geoapp/test_sitemaps.py b/django/contrib/gis/tests/geoapp/test_sitemaps.py
index d9ede80c57..0439a37644 100644
--- a/django/contrib/gis/tests/geoapp/test_sitemaps.py
+++ b/django/contrib/gis/tests/geoapp/test_sitemaps.py
@@ -11,6 +11,7 @@ from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.tests.utils import HAS_SPATIAL_DB
from django.contrib.sites.models import Site
from django.test import TestCase
+from django.test.utils import IgnoreDeprecationWarningsMixin
from django.utils._os import upath
if HAS_GEOS:
@@ -18,17 +19,19 @@ if HAS_GEOS:
@skipUnless(HAS_GEOS and HAS_SPATIAL_DB, "Geos and spatial db are required.")
-class GeoSitemapTest(TestCase):
+class GeoSitemapTest(IgnoreDeprecationWarningsMixin, TestCase):
urls = 'django.contrib.gis.tests.geoapp.urls'
def setUp(self):
+ super(GeoSitemapTest, self).setUp()
Site(id=settings.SITE_ID, domain="example.com", name="example.com").save()
self.old_Site_meta_installed = Site._meta.installed
Site._meta.installed = True
def tearDown(self):
Site._meta.installed = self.old_Site_meta_installed
+ super(GeoSitemapTest, self).tearDown()
def assertChildNodes(self, elem, expected):
"Taken from syndication/tests.py."