Opened 6 years ago

Closed 6 years ago

#21112 closed Bug (fixed)

Sitemaps without lastmod dates are broken (Django 1.7 / master only)

Reported by: Matthias Kestenholz Owned by: nobody
Component: contrib.sitemaps Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no


While running the FeinCMS testsuite with Django 1.7 / master, I found a new problem introduced by 8f5533ab250df07ea84f98d39808806e282468a5 (the fix for #20793).

Traceback (most recent call last):
  File "/home/mk/Projects/feincms/tests/testapp/tests/", line 1428, in test_36_sitemaps
    response = self.client.get('/sitemap.xml')
  File "/home/mk/Projects/feincms/tests/.tox/py27-1.7.X/src/django/django/test/", line 452, in get
    response = super(Client, self).get(path, data=data, **extra)
  File "/home/mk/Projects/feincms/tests/.tox/py27-1.7.X/src/django/django/test/", line 279, in get
    return self.generic('GET', path, **r)
  File "/home/mk/Projects/feincms/tests/.tox/py27-1.7.X/src/django/django/test/", line 341, in generic
    return self.request(**r)
  File "/home/mk/Projects/feincms/tests/.tox/py27-1.7.X/src/django/django/test/", line 423, in request
  File "/home/mk/Projects/feincms/tests/.tox/py27-1.7.X/src/django/django/core/handlers/", line 114, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/mk/Projects/feincms/tests/.tox/py27-1.7.X/src/django/django/contrib/sitemaps/", line 15, in inner
    response = func(request, *args, **kwargs)
  File "/home/mk/Projects/feincms/tests/.tox/py27-1.7.X/src/django/django/contrib/sitemaps/", line 75, in sitemap
AttributeError: 'NoneType' object has no attribute 'utctimetuple'

The attached patch ensures that site.latest_lastmod is only set if it actually is a datetime value. Test is included.

(PS: This is my 21. issue submitted to the Django bugtracker; I did not count patches but I would be a honor if someone could add me to the AUTHORS file. / TIA :-)

Attachments (2)

authors.patch (455 bytes) - added by Matthias Kestenholz 6 years ago.
Add myself to authors
21112.patch (2.9 KB) - added by Matthias Kestenholz 6 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 6 years ago by Simon Charette

Patch needs improvement: set
Severity: Release blockerNormal
Triage Stage: UnreviewedAccepted

Patch looks good!

Please provide a new one with yourself added to the AUTHORS and I'll make sure to honor your request :)

Changed 6 years ago by Matthias Kestenholz

Attachment: authors.patch added

Add myself to authors

comment:2 Changed 6 years ago by Matthias Kestenholz

Simon, thanks for the review. I added the AUTHORS change to 21112.patch.

Changed 6 years ago by Matthias Kestenholz

Attachment: 21112.patch added

comment:3 Changed 6 years ago by Simon Charette <charette.s@…>

Resolution: fixed
Status: newclosed

In f5f662fa5f4efd1f0fdd7901ed58c34f384af532:

Fixed #21112 -- Make sure sitemaps with no lastmod date work correctly.

Thanks to Matthias Kestenholz for the report and patch.

Note: See TracTickets for help on using tickets.
Back to Top