Skip to content

Commit 7708930

Browse files
committed
Addendum to the 'Preventing the Python 3.12's "Deprecated since version 3.12: Use datetime.now() with UTC instead."' problem - with WARCIO 1.7.5 already published and giving us an option to avoid naive datetimes, it's prudent to use this option right now, as the changes on the previous commit for this problem will not use naive datetimes anymore, leading to potential conflicts on deltatimes until naive is removed for good from Python.
1 parent 1b78bb4 commit 7708930

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

pywb/rewrite/templateview.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def format_ts(value, format_='%a, %b %d %Y %H:%M:%S'):
244244
if format_ == '%s':
245245
return timestamp_to_sec(value)
246246
else:
247-
value = timestamp_to_datetime(value)
247+
value = timestamp_to_datetime(value, True)
248248
return value.strftime(format_)
249249

250250
@self.template_filter('urlsplit')

pywb/warcserver/access_checker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ def parse_embargo(self, embargo):
115115

116116
value = embargo.get('before')
117117
if value:
118-
embargo['before'] = timestamp_to_datetime(str(value))
118+
embargo['before'] = timestamp_to_datetime(str(value), True)
119119

120120
value = embargo.get('after')
121121
if value:
122-
embargo['after'] = timestamp_to_datetime(str(value))
122+
embargo['after'] = timestamp_to_datetime(str(value), True)
123123

124124
value = embargo.get('older')
125125
if value:

pywb/warcserver/resource/responseloader.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ def load_resource(self, cdx, params):
302302

303303
req_headers = input_req.get_req_headers()
304304

305-
dt = timestamp_to_datetime(cdx['timestamp'])
305+
dt = timestamp_to_datetime(cdx['timestamp'], True)
306306

307307
if cdx.get('memento_url'):
308308
req_headers['Accept-Datetime'] = datetime_to_http_date(dt)
@@ -582,7 +582,7 @@ def load_resource(self, cdx, params):
582582
schema, rest = load_url.split('://', 1)
583583
target_url = 'metadata://' + rest
584584

585-
dt = timestamp_to_datetime(cdx['timestamp'])
585+
dt = timestamp_to_datetime(cdx['timestamp'], True)
586586

587587
warc_headers['WARC-Type'] = 'metadata'
588588
warc_headers['WARC-Record-ID'] = self._make_warc_id()

0 commit comments

Comments
 (0)