def sitemap(request, sitemaps, section=None):
 (maps, urls) = ([], [])
 if (section is not None):
  if (section not in sitemaps):
   raise Http404((_(u'No sitemap available for section: %r') % section))
  maps.append(sitemaps[section])
 else:
  maps = sitemaps.values()
 page = request.GET.get('p', 1)
 current_site = get_current_site(request)
 for site in maps:
  try:
   if callable(site):
    urls.extend(site().get_urls(page=page, site=current_site))
   else:
    urls.extend(site.get_urls(page=page, site=current_site))
  except EmptyPage:
   raise Http404((_(u'Page %s empty') % page))
  except PageNotAnInteger:
   raise Http404((_(u"No page '%s'") % page))
 xml = smart_str(loader.render_to_string('gis/sitemaps/geo_sitemap.xml', {'urlset': urls}))
 return HttpResponse(xml, content_type='application/xml')

def sitemap ( request , sitemaps , section = None ) : ( maps , urls ) = ( [ ] , [ ] ) if ( section is not None ) : if ( section not in sitemaps ) : raise Http404 ( ( _ ( u'No sitemap available for section: %r' ) % section ) ) maps . append ( sitemaps [ section ] ) else : maps = sitemaps . values ( ) page = request . GET . get ( 'p' , 1 ) current_site = get_current_site ( request ) for site in maps : try : if callable ( site ) : urls . extend ( site ( ) . get_urls ( page = page , site = current_site ) ) else : urls . extend ( site . get_urls ( page = page , site = current_site ) ) except EmptyPage : raise Http404 ( ( _ ( u'Page %s empty' ) % page ) ) except PageNotAnInteger : raise Http404 ( ( _ ( u"No page '%s'" ) % page ) ) xml = smart_str ( loader . render_to_string ( 'gis/sitemaps/geo_sitemap.xml' , { 'urlset' : urls } ) ) return HttpResponse ( xml , content_type = 'application/xml' )
this view generates a sitemap with additional geographic elements defined by google .