Ticket #10909: sitemaps.patch

File sitemaps.patch, 1.2 KB (added by QingFeng, 16 years ago)
  • django/contrib/sitemaps/__init__.py

     
    11from django.core import urlresolvers, paginator
     2from django.conf import settings
    23import urllib
    34
    45PING_URL = "http://www.google.com/webmasters/tools/ping"
     
    6061    paginator = property(_get_paginator)
    6162
    6263    def get_urls(self, page=1):
    63         from django.contrib.sites.models import Site
    64         current_site = Site.objects.get_current()
     64        if 'DOMAIN' in settings.get_all_members():
     65            domain = settings.DOMAIN
     66        else:
     67            from django.contrib.sites.models import Site
     68            current_site = Site.objects.get_current()
     69            domain = current_site.domain
    6570        urls = []
    6671        for item in self.paginator.page(page).object_list:
    67             loc = "http://%s%s" % (current_site.domain, self.__get('location', item))
     72            loc = "http://%s%s" % (domain, self.__get('location', item))
    6873            url_info = {
    6974                'location':   loc,
    7075                'lastmod':    self.__get('lastmod', item, None),
Back to Top