Fixed #2643 -- Fixed incorrect reverse() view names in sitemaps contrib app. Thanks for the patch, dummy@habmalnefrage.de
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3710 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
46d7defb7d
commit
5a1d560fb3
|
@ -16,11 +16,11 @@ def ping_google(sitemap_url=None, ping_url=PING_URL):
|
||||||
if sitemap_url is None:
|
if sitemap_url is None:
|
||||||
try:
|
try:
|
||||||
# First, try to get the "index" sitemap URL.
|
# First, try to get the "index" sitemap URL.
|
||||||
sitemap_url = urlresolvers.reverse('django.contrib.sitemap.views.index')
|
sitemap_url = urlresolvers.reverse('django.contrib.sitemaps.views.index')
|
||||||
except urlresolvers.NoReverseMatch:
|
except urlresolvers.NoReverseMatch:
|
||||||
try:
|
try:
|
||||||
# Next, try for the "global" sitemap URL.
|
# Next, try for the "global" sitemap URL.
|
||||||
sitemap_url = urlresolvers.reverse('django.contrib.sitemap.views.sitemap')
|
sitemap_url = urlresolvers.reverse('django.contrib.sitemaps.views.sitemap')
|
||||||
except urlresolvers.NoReverseMatch:
|
except urlresolvers.NoReverseMatch:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ def index(request, sitemaps):
|
||||||
sites = []
|
sites = []
|
||||||
protocol = request.is_secure() and 'https' or 'http'
|
protocol = request.is_secure() and 'https' or 'http'
|
||||||
for section in sitemaps.keys():
|
for section in sitemaps.keys():
|
||||||
sitemap_url = urlresolvers.reverse('django.contrib.sitemap.views.sitemap', kwargs={'section': section})
|
sitemap_url = urlresolvers.reverse('django.contrib.sitemaps.views.sitemap', kwargs={'section': section})
|
||||||
sites.append('%s://%s%s' % (protocol, current_site.domain, sitemap_url))
|
sites.append('%s://%s%s' % (protocol, current_site.domain, sitemap_url))
|
||||||
xml = loader.render_to_string('sitemap_index.xml', {'sitemaps': sites})
|
xml = loader.render_to_string('sitemap_index.xml', {'sitemaps': sites})
|
||||||
return HttpResponse(xml, mimetype='application/xml')
|
return HttpResponse(xml, mimetype='application/xml')
|
||||||
|
|
Loading…
Reference in New Issue