Ticket #10909: sitemaps2.patch
File sitemaps2.patch, 1.9 KB (added by , 16 years ago) |
---|
-
django/contrib/sitemaps/__init__.py
1 1 from django.core import urlresolvers, paginator 2 from django.conf import settings 2 3 import urllib 3 4 4 5 PING_URL = "http://www.google.com/webmasters/tools/ping" … … 27 28 if sitemap_url is None: 28 29 raise SitemapNotFound("You didn't provide a sitemap_url, and the sitemap URL couldn't be auto-detected.") 29 30 30 from django.contrib.sites.models import Site 31 current_site = Site.objects.get_current() 32 url = "http://%s%s" % (current_site.domain, sitemap_url) 31 if 'DOMAIN' in settings.get_all_members(): 32 domain = settings.DOMAIN 33 else: 34 from django.contrib.sites.models import Site 35 current_site = Site.objects.get_current() 36 domain = current_site.domain 37 url = "http://%s%s" % (domain, sitemap_url) 33 38 params = urllib.urlencode({'sitemap':url}) 34 39 urllib.urlopen("%s?%s" % (ping_url, params)) 35 40 … … 60 65 paginator = property(_get_paginator) 61 66 62 67 def get_urls(self, page=1): 63 from django.contrib.sites.models import Site 64 current_site = Site.objects.get_current() 68 if 'DOMAIN' in settings.get_all_members(): 69 domain = settings.DOMAIN 70 else: 71 from django.contrib.sites.models import Site 72 current_site = Site.objects.get_current() 73 domain = current_site.domain 65 74 urls = [] 66 75 for item in self.paginator.page(page).object_list: 67 loc = "http://%s%s" % ( current_site.domain, self.__get('location', item))76 loc = "http://%s%s" % (domain, self.__get('location', item)) 68 77 url_info = { 69 78 'location': loc, 70 79 'lastmod': self.__get('lastmod', item, None),