1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +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:
Ilya Kreymer 2014-05-30 11:17:12 -07:00
parent 52040127b3
commit f9710d033c
3 changed files with 7 additions and 11 deletions

View File

@ -2,9 +2,11 @@
{% if rule.js_rewrite_location %}
<script src='{{ wbrequest.host_prefix }}/{{ static_path }}/wombat.js'> </script>
<script>
WB_wombat_init("{{wbrequest.wb_prefix}}",
"{{cdx['timestamp']}}",
"{{cdx['original'] | host}}",
{% set urlsplit = cdx['original'] | urlsplit %}
WB_wombat_init("{{ wbrequest.wb_prefix}}",
"{{ cdx['timestamp'] if include_ts else ''}}",
"{{ urlsplit.scheme }}",
"{{ urlsplit.netloc }}",
"{{ cdx.timestamp | format_ts('%s') }}");
</script>
{% endif %}

View File

@ -46,12 +46,6 @@ def format_ts(value, format_='%a, %b %d %Y %H:%M:%S'):
return value.strftime(format_)
@template_filter('host')
def get_hostname(url):
split = urlparse.urlsplit(url)
return split.netloc
@template_filter('urlsplit')
def get_urlsplit(url):
split = urlparse.urlsplit(url)

View File

@ -188,12 +188,12 @@ class TestWb:
# without timestamp
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']
# with timestamp
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']