mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-24 06:59:52 +01:00
fix integration test for 307
update head_insert for new wombat remove redundant host jinja func, use 'urlsplit' instead
This commit is contained in:
parent
52040127b3
commit
f9710d033c
@ -2,9 +2,11 @@
|
|||||||
{% if rule.js_rewrite_location %}
|
{% if rule.js_rewrite_location %}
|
||||||
<script src='{{ wbrequest.host_prefix }}/{{ static_path }}/wombat.js'> </script>
|
<script src='{{ wbrequest.host_prefix }}/{{ static_path }}/wombat.js'> </script>
|
||||||
<script>
|
<script>
|
||||||
WB_wombat_init("{{wbrequest.wb_prefix}}",
|
{% set urlsplit = cdx['original'] | urlsplit %}
|
||||||
"{{cdx['timestamp']}}",
|
WB_wombat_init("{{ wbrequest.wb_prefix}}",
|
||||||
"{{cdx['original'] | host}}",
|
"{{ cdx['timestamp'] if include_ts else ''}}",
|
||||||
|
"{{ urlsplit.scheme }}",
|
||||||
|
"{{ urlsplit.netloc }}",
|
||||||
"{{ cdx.timestamp | format_ts('%s') }}");
|
"{{ cdx.timestamp | format_ts('%s') }}");
|
||||||
</script>
|
</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -46,12 +46,6 @@ def format_ts(value, format_='%a, %b %d %Y %H:%M:%S'):
|
|||||||
return value.strftime(format_)
|
return value.strftime(format_)
|
||||||
|
|
||||||
|
|
||||||
@template_filter('host')
|
|
||||||
def get_hostname(url):
|
|
||||||
split = urlparse.urlsplit(url)
|
|
||||||
return split.netloc
|
|
||||||
|
|
||||||
|
|
||||||
@template_filter('urlsplit')
|
@template_filter('urlsplit')
|
||||||
def get_urlsplit(url):
|
def get_urlsplit(url):
|
||||||
split = urlparse.urlsplit(url)
|
split = urlparse.urlsplit(url)
|
||||||
|
@ -188,12 +188,12 @@ class TestWb:
|
|||||||
|
|
||||||
# without timestamp
|
# without timestamp
|
||||||
resp = self.testapp.get('/_css/2013.1/screen.css', headers = [('Referer', 'http://localhost:8080/pywb/2014/http://iana.org/')])
|
resp = self.testapp.get('/_css/2013.1/screen.css', headers = [('Referer', 'http://localhost:8080/pywb/2014/http://iana.org/')])
|
||||||
assert resp.status_int == 302
|
assert resp.status_int == 307
|
||||||
assert resp.headers['Location'] == target, resp.headers['Location']
|
assert resp.headers['Location'] == target, resp.headers['Location']
|
||||||
|
|
||||||
# with timestamp
|
# with timestamp
|
||||||
resp = self.testapp.get('/2014/_css/2013.1/screen.css', headers = [('Referer', 'http://localhost:8080/pywb/2014/http://iana.org/')])
|
resp = self.testapp.get('/2014/_css/2013.1/screen.css', headers = [('Referer', 'http://localhost:8080/pywb/2014/http://iana.org/')])
|
||||||
assert resp.status_int == 302
|
assert resp.status_int == 307
|
||||||
assert resp.headers['Location'] == target, resp.headers['Location']
|
assert resp.headers['Location'] == target, resp.headers['Location']
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user