mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-15 00:03:28 +01:00
memento: add original link to timemap #10
This commit is contained in:
parent
2a605652c6
commit
c6c9fe680a
@ -142,6 +142,10 @@ def make_timemap(wbrequest, cdx_lines):
|
||||
'type="application/link-format"; from="{1}",\n')
|
||||
yield timemap.format(prefix + wbrequest.wb_url.to_str(), from_date)
|
||||
|
||||
# original link
|
||||
original = '<{0}>; rel="original",\n'
|
||||
yield original.format(url)
|
||||
|
||||
# timegate link
|
||||
timegate = '<{0}>; rel="timegate",\n'
|
||||
yield timegate.format(prefix + url)
|
||||
@ -158,6 +162,6 @@ def make_timemap(wbrequest, cdx_lines):
|
||||
|
||||
prev_cdx = cdx
|
||||
|
||||
# last memento link
|
||||
# last memento link, if any
|
||||
if prev_cdx:
|
||||
yield make_memento_link(prev_cdx, prefix, end='')
|
||||
|
@ -140,17 +140,19 @@ class TestWb:
|
||||
|
||||
lines = resp.body.split('\n')
|
||||
|
||||
assert len(lines) == 4
|
||||
assert len(lines) == 5
|
||||
|
||||
assert lines[0] == '<http://localhost:80/pywb/timemap/*/http://example.com?example=1>; \
|
||||
rel="self"; type="application/link-format"; from="Fri, 03 Jan 2014 03:03:21 GMT",'
|
||||
|
||||
assert lines[1] == '<http://localhost:80/pywb/http://example.com?example=1>; rel="timegate",'
|
||||
assert lines[1] == '<http://example.com?example=1>; rel="original",'
|
||||
|
||||
assert lines[2] == '<http://localhost:80/pywb/20140103030321/http://example.com?example=1>; \
|
||||
assert lines[2] == '<http://localhost:80/pywb/http://example.com?example=1>; rel="timegate",'
|
||||
|
||||
assert lines[3] == '<http://localhost:80/pywb/20140103030321/http://example.com?example=1>; \
|
||||
rel="memento"; datetime="Fri, 03 Jan 2014 03:03:21 GMT",'
|
||||
|
||||
assert lines[3] == '<http://localhost:80/pywb/20140103030341/http://example.com?example=1>; \
|
||||
assert lines[4] == '<http://localhost:80/pywb/20140103030341/http://example.com?example=1>; \
|
||||
rel="memento"; datetime="Fri, 03 Jan 2014 03:03:41 GMT"'
|
||||
|
||||
# Below functions test pywb proxy mode behavior
|
||||
|
Loading…
x
Reference in New Issue
Block a user