Loading AUTHORS +1 −0 Original line number Diff line number Diff line Loading @@ -338,6 +338,7 @@ answer newbie questions, and generally made Django that much better: Niall Kelly <duke.sam.vimes@gmail.com> Ryan Kelly <ryan@rfk.id.au> Thomas Kerpe <thomas@kerpe.net> Matthias Kestenholz <mk@406.ch> Wiley Kestner <wiley.kestner@gmail.com> Ossama M. Khayat <okhayat@yahoo.com> Ben Khoo <khoobks@westnet.com.au> Loading django/contrib/sitemaps/__init__.py +1 −1 Original line number Diff line number Diff line Loading @@ -102,7 +102,7 @@ class Sitemap(object): 'priority': str(priority if priority is not None else ''), } urls.append(url_info) if all_items_lastmod: if all_items_lastmod and latest_lastmod: self.latest_lastmod = latest_lastmod return urls Loading django/contrib/sitemaps/tests/test_http.py +4 −0 Original line number Diff line number Diff line Loading @@ -166,3 +166,7 @@ class HTTPSitemapTests(SitemapTestsBase): response = self.client.get('/simple/sitemap.xml') self.assertEqual(response['X-Robots-Tag'], 'noindex, noodp, noarchive') def test_empty_sitemap(self): response = self.client.get('/empty/sitemap.xml') self.assertEqual(response.status_code, 200) django/contrib/sitemaps/tests/urls/http.py +14 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,15 @@ class SimpleSitemap(Sitemap): return [object()] class EmptySitemap(Sitemap): changefreq = "never" priority = 0.5 location = '/location/' def items(self): return [] class FixedLastmodSitemap(SimpleSitemap): lastmod = datetime(2013, 3, 13, 10, 0, 0) Loading @@ -37,6 +46,10 @@ simple_sitemaps = { 'simple': SimpleSitemap, } empty_sitemaps = { 'empty': EmptySitemap, } fixed_lastmod_sitemaps = { 'fixed-lastmod': FixedLastmodSitemap, } Loading @@ -62,6 +75,7 @@ urlpatterns = patterns('django.contrib.sitemaps.views', (r'^simple/sitemap\.xml$', 'sitemap', {'sitemaps': simple_sitemaps}), (r'^simple/custom-sitemap\.xml$', 'sitemap', {'sitemaps': simple_sitemaps, 'template_name': 'custom_sitemap.xml'}), (r'^empty/sitemap\.xml$', 'sitemap', {'sitemaps': empty_sitemaps}), (r'^lastmod/sitemap\.xml$', 'sitemap', {'sitemaps': fixed_lastmod_sitemaps}), (r'^lastmod-mixed/sitemap\.xml$', 'sitemap', {'sitemaps': fixed_lastmod__mixed_sitemaps}), (r'^generic/sitemap\.xml$', 'sitemap', {'sitemaps': generic_sitemaps}), Loading Loading
AUTHORS +1 −0 Original line number Diff line number Diff line Loading @@ -338,6 +338,7 @@ answer newbie questions, and generally made Django that much better: Niall Kelly <duke.sam.vimes@gmail.com> Ryan Kelly <ryan@rfk.id.au> Thomas Kerpe <thomas@kerpe.net> Matthias Kestenholz <mk@406.ch> Wiley Kestner <wiley.kestner@gmail.com> Ossama M. Khayat <okhayat@yahoo.com> Ben Khoo <khoobks@westnet.com.au> Loading
django/contrib/sitemaps/__init__.py +1 −1 Original line number Diff line number Diff line Loading @@ -102,7 +102,7 @@ class Sitemap(object): 'priority': str(priority if priority is not None else ''), } urls.append(url_info) if all_items_lastmod: if all_items_lastmod and latest_lastmod: self.latest_lastmod = latest_lastmod return urls Loading
django/contrib/sitemaps/tests/test_http.py +4 −0 Original line number Diff line number Diff line Loading @@ -166,3 +166,7 @@ class HTTPSitemapTests(SitemapTestsBase): response = self.client.get('/simple/sitemap.xml') self.assertEqual(response['X-Robots-Tag'], 'noindex, noodp, noarchive') def test_empty_sitemap(self): response = self.client.get('/empty/sitemap.xml') self.assertEqual(response.status_code, 200)
django/contrib/sitemaps/tests/urls/http.py +14 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,15 @@ class SimpleSitemap(Sitemap): return [object()] class EmptySitemap(Sitemap): changefreq = "never" priority = 0.5 location = '/location/' def items(self): return [] class FixedLastmodSitemap(SimpleSitemap): lastmod = datetime(2013, 3, 13, 10, 0, 0) Loading @@ -37,6 +46,10 @@ simple_sitemaps = { 'simple': SimpleSitemap, } empty_sitemaps = { 'empty': EmptySitemap, } fixed_lastmod_sitemaps = { 'fixed-lastmod': FixedLastmodSitemap, } Loading @@ -62,6 +75,7 @@ urlpatterns = patterns('django.contrib.sitemaps.views', (r'^simple/sitemap\.xml$', 'sitemap', {'sitemaps': simple_sitemaps}), (r'^simple/custom-sitemap\.xml$', 'sitemap', {'sitemaps': simple_sitemaps, 'template_name': 'custom_sitemap.xml'}), (r'^empty/sitemap\.xml$', 'sitemap', {'sitemaps': empty_sitemaps}), (r'^lastmod/sitemap\.xml$', 'sitemap', {'sitemaps': fixed_lastmod_sitemaps}), (r'^lastmod-mixed/sitemap\.xml$', 'sitemap', {'sitemaps': fixed_lastmod__mixed_sitemaps}), (r'^generic/sitemap\.xml$', 'sitemap', {'sitemaps': generic_sitemaps}), Loading