Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #25989 -- Find latest lastmod of all sitemaps #5877

Closed
wants to merge 1 commit into from
Closed

Fixed #25989 -- Find latest lastmod of all sitemaps #5877

wants to merge 1 commit into from

Conversation

allixx
Copy link
Contributor

@allixx allixx commented Dec 26, 2015

Determine latest lastmod of all sitemaps supplied to
contrib.sitemaps.views.sitemap, instead of unconditionally picking
lastmod of a last sitemap.

if hasattr(site, 'latest_lastmod'):
# if latest_lastmod is defined for site, set header so as
if lastmod is not None:
# if lastmod is defined for at least one site, set header so as
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we only set 'Last-Modified' to the most recent lastmod if all sites define one and don't set anything if at least one site doesn't define one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to agree with you here. The code is rewritten to explicitly require having lastmod defined for all sitemaps.

@allixx
Copy link
Contributor Author

allixx commented Dec 29, 2015

Tests added.

Determine latest lastmod of all sitemaps supplied to
contrib.sitemaps.views.sitemap, instead of unconditionally picking
lastmod of a last sitemap.
All sitemaps are required to have a lastmod.
@allixx
Copy link
Contributor Author

allixx commented Dec 30, 2015

Fixed python35 TypeError: unorderable types: time.struct_time() > NoneType() error.

@allixx allixx closed this Dec 30, 2015
@allixx allixx reopened this Dec 30, 2015
@@ -110,6 +110,38 @@ def test_sitemap_last_modified_mixed(self):
response = self.client.get('/lastmod-mixed/sitemap.xml')
self.assertFalse(response.has_header('Last-Modified'))

def test_sitemaps_lastmod_mixed_ascending_last_modified_missing(self):
"""
Tests that Last-Modified header is omitted when lastmod not found in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would the Last-Modified header not be set when it is not found in ALL maps? shouldn't it be set as soon as one is found.. and only NOT set if no last_mod is found.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs don't explicitly define this behaviour. If we stretch lastmod calculation logic of a Sitemap class to this case, all sitemaps should have a lasmod.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes.. I see what you mean.

@timgraham
Copy link
Member

merged in 002a4f7, thanks!

@timgraham timgraham closed this Jan 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants