mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-24 06:59:52 +01:00
minor fixes: wombat add document.WB_wombat_location
loaders: file 'urls' starting with . and / are always file paths pep8 fixes for cdx, utils packages
This commit is contained in:
parent
28b49f9aeb
commit
673ff35d15
@ -64,7 +64,8 @@ class CDXObject(OrderedDict):
|
|||||||
cdxformat = i
|
cdxformat = i
|
||||||
|
|
||||||
if not cdxformat:
|
if not cdxformat:
|
||||||
raise CDXException('unknown {0}-field cdx format'.format(len(fields)))
|
msg = 'unknown {0}-field cdx format'.format(len(fields))
|
||||||
|
raise CDXException(msg)
|
||||||
|
|
||||||
for header, field in itertools.izip(cdxformat, fields):
|
for header, field in itertools.izip(cdxformat, fields):
|
||||||
self[header] = field
|
self[header] = field
|
||||||
|
@ -253,6 +253,7 @@ def cdx_sort_closest(closest, cdx_iter, limit=10):
|
|||||||
# Fields to append from cdx original to revisit
|
# Fields to append from cdx original to revisit
|
||||||
ORIG_TUPLE = ['length', 'offset', 'filename']
|
ORIG_TUPLE = ['length', 'offset', 'filename']
|
||||||
|
|
||||||
|
|
||||||
def cdx_resolve_revisits(cdx_iter):
|
def cdx_resolve_revisits(cdx_iter):
|
||||||
"""
|
"""
|
||||||
resolve revisits.
|
resolve revisits.
|
||||||
|
@ -196,6 +196,7 @@ function WB_wombat_Init(replayPrefix, captureDate, origHost)
|
|||||||
WB_wombat_origHost = "http://" + origHost;
|
WB_wombat_origHost = "http://" + origHost;
|
||||||
|
|
||||||
window.WB_wombat_location = WB_CopyLocationObj(window.self.location);
|
window.WB_wombat_location = WB_CopyLocationObj(window.self.location);
|
||||||
|
document.WB_wombat_location = window.WB_wombat_location;
|
||||||
|
|
||||||
|
|
||||||
if (window.self.location != window.top.location) {
|
if (window.self.location != window.top.location) {
|
||||||
|
@ -47,7 +47,8 @@ class BlockLoader(object):
|
|||||||
Load a file-like reader from the local file system
|
Load a file-like reader from the local file system
|
||||||
"""
|
"""
|
||||||
|
|
||||||
file_only = False
|
# if starting with . or /, can only be a file path..
|
||||||
|
file_only = url.startswith(('/', '.'))
|
||||||
|
|
||||||
if url.startswith('file://'):
|
if url.startswith('file://'):
|
||||||
url = url[len('file://'):]
|
url = url[len('file://'):]
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
|
||||||
|
|
||||||
#=================================================================
|
#=================================================================
|
||||||
class WbException(Exception):
|
class WbException(Exception):
|
||||||
def status(self):
|
def status(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user