MCPcopy
hub / github.com/django/django / was_modified_since

Function was_modified_since

django/views/static.py:103–122  ·  view source on GitHub ↗

Was something modified since the user last downloaded it? header This is the value of the If-Modified-Since header. If this is None, I'll just return True. mtime This is the modification time of the item we're talking about.

(header=None, mtime=0)

Source from the content-addressed store, hash-verified

101
102
103def was_modified_since(header=None, mtime=0):
104 """
105 Was something modified since the user last downloaded it?
106
107 header
108 This is the value of the If-Modified-Since header. If this is None,
109 I'll just return True.
110
111 mtime
112 This is the modification time of the item we're talking about.
113 """
114 try:
115 if header is None:
116 raise ValueError
117 header_mtime = parse_http_date(header)
118 if int(mtime) > header_mtime:
119 raise ValueError
120 except (ValueError, OverflowError):
121 return True
122 return False

Callers 3

serveFunction · 0.85

Calls 1

parse_http_dateFunction · 0.90