Permalink
Browse files

Fixed #18531 -- Deprecated Geo Sitemaps

I've chosen a quick deprecation path, as Geo Sitemaps themselves
are deprecated from some time now.
  • Loading branch information...
1 parent a7cf48a commit 5c61b8519d8ce02e4308201f3e81fdc99ad80b58 @claudep claudep committed Dec 7, 2013
@@ -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:
@@ -11,24 +11,27 @@
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:
from .models import City, Country
@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."
@@ -147,6 +147,10 @@ these changes.
* The session key ``django_language`` will no longer be read for backwards
compatibility.
+* Geographic Sitemaps will be removed
+ (``django.contrib.gis.sitemaps.views.index`` and
+ ``django.contrib.gis.sitemaps.views.sitemap``).
+
1.9
---
View
@@ -854,3 +854,9 @@ The function ``memoize`` is deprecated and should be replaced by the
Django ships a backport of this decorator for older Python versions and it's
available at ``django.utils.lru_cache.lru_cache``. The deprecated function will
be removed in Django 1.9.
+
+Geo Sitemaps
+~~~~~~~~~~~~
+
+Google has retired support for the Geo Sitemaps format. Hence Django support
+for Geo Sitemaps is deprecated and will be removed in Django 1.8.

0 comments on commit 5c61b85

Please sign in to comment.