MCPcopy
hub / github.com/django/django / _get_latest_lastmod

Function _get_latest_lastmod

django/contrib/sitemaps/views.py:30–39  ·  view source on GitHub ↗

Returns the latest `lastmod` where `lastmod` can be either a date or a datetime.

(current_lastmod, new_lastmod)

Source from the content-addressed store, hash-verified

28
29
30def _get_latest_lastmod(current_lastmod, new_lastmod):
31 """
32 Returns the latest `lastmod` where `lastmod` can be either a date or a
33 datetime.
34 """
35 if not isinstance(new_lastmod, datetime.datetime):
36 new_lastmod = datetime.datetime.combine(new_lastmod, datetime.time.min)
37 if timezone.is_naive(new_lastmod):
38 new_lastmod = timezone.make_aware(new_lastmod, datetime.UTC)
39 return new_lastmod if current_lastmod is None else max(current_lastmod, new_lastmod)
40
41
42@x_robots_tag

Callers 2

indexFunction · 0.85
sitemapFunction · 0.85

Calls 1

combineMethod · 0.80

Tested by

no test coverage detected