Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Fixes for Geo sitemap errata.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 5485e0d97f86b04bd257e391986b62b1cff1c90a 1 parent 8a88379
@jbronn jbronn authored
2  django/contrib/gis/sitemaps/
@@ -41,7 +41,7 @@ def get_urls(self, page=1):
This method is overrridden so the appropriate `geo_format` attribute
is placed on each URL element.
- urls = Sitemap.get_urls(self)
+ urls = Sitemap.get_urls(self, page=page)
for url in urls: url['geo_format'] = 'georss'
return urls
14 django/contrib/gis/sitemaps/
@@ -5,13 +5,11 @@
from django.core import urlresolvers
from django.core.paginator import EmptyPage, PageNotAnInteger
from django.db.models import get_model
+from django.contrib.gis.db.models.fields import GeometryField
from django.utils.encoding import smart_str
from django.contrib.gis.shortcuts import render_to_kml, render_to_kmz
-class KMLNotFound(Exception):
- pass
def index(request, sitemaps):
This view generates a sitemap index that uses the proper view
@@ -71,7 +69,15 @@ def kml(request, label, model, field_name=None, compress=False):
placemarks = []
klass = get_model(label, model)
if not klass:
- raise KMLNotFound("You must supply a valid app.model label. Got %s.%s" % (label, model))
+ raise Http404('You must supply a valid app label and module name. Got "%s.%s"' % (label, model))
+ if field_name:
+ try:
+ info = klass._meta.get_field_by_name(field_name)
+ if not isinstance(info[0], GeometryField):
+ raise Exception
+ except:
+ raise Http404('Invalid geometry field.')
if SpatialBackend.postgis:
# PostGIS will take care of transformation.

0 comments on commit 5485e0d

Please sign in to comment.
Something went wrong with that request. Please try again.