Ticket #12347: sitemaps-urllist.patch
File sitemaps-urllist.patch, 1.2 KB (added by , 15 years ago) |
---|
-
django/contrib/sitemaps/views.py
22 22 xml = loader.render_to_string('sitemap_index.xml', {'sitemaps': sites}) 23 23 return HttpResponse(xml, mimetype='application/xml') 24 24 25 def sitemap(request, sitemaps, section=None):25 def _get_urls(request, sitemaps, section=None): 26 26 maps, urls = [], [] 27 27 if section is not None: 28 28 if section not in sitemaps: … … 41 41 raise Http404("Page %s empty" % page) 42 42 except PageNotAnInteger: 43 43 raise Http404("No page '%s'" % page) 44 return urls 45 46 def sitemap(request, sitemaps, section=None): 47 urls = _get_urls(request, sitemaps, section) 44 48 xml = smart_str(loader.render_to_string('sitemap.xml', {'urlset': urls})) 45 49 return HttpResponse(xml, mimetype='application/xml') 50 51 def urllist(request, sitemaps, section=None): 52 urls = [url['location'] for url in _get_urls(request, sitemaps, section)] 53 text = smart_str('\n'.join(urls)) 54 return HttpResponse(text, mimetype='text/plain')