Ticket #21112: 21112.patch

File 21112.patch, 2.9 KB (added by Matthias Kestenholz, 11 years ago)
  • AUTHORS

    diff --git a/AUTHORS b/AUTHORS
    index a2a0eb9..7e620f8 100644
    a b answer newbie questions, and generally made Django that much better:  
    338338    Niall Kelly <duke.sam.vimes@gmail.com>
    339339    Ryan Kelly <ryan@rfk.id.au>
    340340    Thomas Kerpe <thomas@kerpe.net>
     341    Matthias Kestenholz <mk@406.ch>
    341342    Wiley Kestner <wiley.kestner@gmail.com>
    342343    Ossama M. Khayat <okhayat@yahoo.com>
    343344    Ben Khoo <khoobks@westnet.com.au>
  • django/contrib/sitemaps/__init__.py

    diff --git a/django/contrib/sitemaps/__init__.py b/django/contrib/sitemaps/__init__.py
    index 996e719..fd71276 100644
    a b class Sitemap(object):  
    102102                'priority':   str(priority if priority is not None else ''),
    103103            }
    104104            urls.append(url_info)
    105         if all_items_lastmod:
     105        if all_items_lastmod and latest_lastmod:
    106106            self.latest_lastmod = latest_lastmod
    107107        return urls
    108108
  • django/contrib/sitemaps/tests/test_http.py

    diff --git a/django/contrib/sitemaps/tests/test_http.py b/django/contrib/sitemaps/tests/test_http.py
    index c870b44..6d6862e 100644
    a b class HTTPSitemapTests(SitemapTestsBase):  
    166166
    167167        response = self.client.get('/simple/sitemap.xml')
    168168        self.assertEqual(response['X-Robots-Tag'], 'noindex, noodp, noarchive')
     169
     170    def test_empty_sitemap(self):
     171        response = self.client.get('/empty/sitemap.xml')
     172        self.assertEqual(response.status_code, 200)
  • django/contrib/sitemaps/tests/urls/http.py

    diff --git a/django/contrib/sitemaps/tests/urls/http.py b/django/contrib/sitemaps/tests/urls/http.py
    index 6721d72..2cadb23 100644
    a b class SimpleSitemap(Sitemap):  
    1616        return [object()]
    1717
    1818
     19class EmptySitemap(Sitemap):
     20    changefreq = "never"
     21    priority = 0.5
     22    location = '/location/'
     23
     24    def items(self):
     25        return []
     26
     27
    1928class FixedLastmodSitemap(SimpleSitemap):
    2029    lastmod = datetime(2013, 3, 13, 10, 0, 0)
    2130
    simple_sitemaps = {  
    3746    'simple': SimpleSitemap,
    3847}
    3948
     49empty_sitemaps = {
     50    'empty': EmptySitemap,
     51}
     52
    4053fixed_lastmod_sitemaps = {
    4154    'fixed-lastmod': FixedLastmodSitemap,
    4255}
    urlpatterns = patterns('django.contrib.sitemaps.views',  
    6275    (r'^simple/sitemap\.xml$', 'sitemap', {'sitemaps': simple_sitemaps}),
    6376    (r'^simple/custom-sitemap\.xml$', 'sitemap',
    6477        {'sitemaps': simple_sitemaps, 'template_name': 'custom_sitemap.xml'}),
     78    (r'^empty/sitemap\.xml$', 'sitemap', {'sitemaps': empty_sitemaps}),
    6579    (r'^lastmod/sitemap\.xml$', 'sitemap', {'sitemaps': fixed_lastmod_sitemaps}),
    6680    (r'^lastmod-mixed/sitemap\.xml$', 'sitemap', {'sitemaps': fixed_lastmod__mixed_sitemaps}),
    6781    (r'^generic/sitemap\.xml$', 'sitemap', {'sitemaps': generic_sitemaps}),
Back to Top