diff --git a/AUTHORS b/AUTHORS
index a2a0eb9..7e620f8 100644
a
|
b
|
answer newbie questions, and generally made Django that much better:
|
338 | 338 | Niall Kelly <duke.sam.vimes@gmail.com> |
339 | 339 | Ryan Kelly <ryan@rfk.id.au> |
340 | 340 | Thomas Kerpe <thomas@kerpe.net> |
| 341 | Matthias Kestenholz <mk@406.ch> |
341 | 342 | Wiley Kestner <wiley.kestner@gmail.com> |
342 | 343 | Ossama M. Khayat <okhayat@yahoo.com> |
343 | 344 | Ben Khoo <khoobks@westnet.com.au> |
diff --git a/django/contrib/sitemaps/__init__.py b/django/contrib/sitemaps/__init__.py
index 996e719..fd71276 100644
a
|
b
|
class Sitemap(object):
|
102 | 102 | 'priority': str(priority if priority is not None else ''), |
103 | 103 | } |
104 | 104 | urls.append(url_info) |
105 | | if all_items_lastmod: |
| 105 | if all_items_lastmod and latest_lastmod: |
106 | 106 | self.latest_lastmod = latest_lastmod |
107 | 107 | return urls |
108 | 108 | |
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):
|
166 | 166 | |
167 | 167 | response = self.client.get('/simple/sitemap.xml') |
168 | 168 | 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) |
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):
|
16 | 16 | return [object()] |
17 | 17 | |
18 | 18 | |
| 19 | class EmptySitemap(Sitemap): |
| 20 | changefreq = "never" |
| 21 | priority = 0.5 |
| 22 | location = '/location/' |
| 23 | |
| 24 | def items(self): |
| 25 | return [] |
| 26 | |
| 27 | |
19 | 28 | class FixedLastmodSitemap(SimpleSitemap): |
20 | 29 | lastmod = datetime(2013, 3, 13, 10, 0, 0) |
21 | 30 | |
… |
… |
simple_sitemaps = {
|
37 | 46 | 'simple': SimpleSitemap, |
38 | 47 | } |
39 | 48 | |
| 49 | empty_sitemaps = { |
| 50 | 'empty': EmptySitemap, |
| 51 | } |
| 52 | |
40 | 53 | fixed_lastmod_sitemaps = { |
41 | 54 | 'fixed-lastmod': FixedLastmodSitemap, |
42 | 55 | } |
… |
… |
urlpatterns = patterns('django.contrib.sitemaps.views',
|
62 | 75 | (r'^simple/sitemap\.xml$', 'sitemap', {'sitemaps': simple_sitemaps}), |
63 | 76 | (r'^simple/custom-sitemap\.xml$', 'sitemap', |
64 | 77 | {'sitemaps': simple_sitemaps, 'template_name': 'custom_sitemap.xml'}), |
| 78 | (r'^empty/sitemap\.xml$', 'sitemap', {'sitemaps': empty_sitemaps}), |
65 | 79 | (r'^lastmod/sitemap\.xml$', 'sitemap', {'sitemaps': fixed_lastmod_sitemaps}), |
66 | 80 | (r'^lastmod-mixed/sitemap\.xml$', 'sitemap', {'sitemaps': fixed_lastmod__mixed_sitemaps}), |
67 | 81 | (r'^generic/sitemap\.xml$', 'sitemap', {'sitemaps': generic_sitemaps}), |