mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-24 06:59:52 +01:00
pep8 cleanup pass
This commit is contained in:
parent
e4297ddabe
commit
fa813bdd19
@ -18,7 +18,7 @@ def create_app():
|
|||||||
|
|
||||||
result, unknown = parser.parse_known_args()
|
result, unknown = parser.parse_known_args()
|
||||||
|
|
||||||
config=dict(proxyhostport=result.proxy, framed_replay=True)
|
config = dict(proxyhostport=result.proxy, framed_replay=True)
|
||||||
|
|
||||||
app = init_app(create_live_rewriter_app, load_yaml=False,
|
app = init_app(create_live_rewriter_app, load_yaml=False,
|
||||||
config=config)
|
config=config)
|
||||||
|
@ -72,7 +72,6 @@ class ArchivalRouter(object):
|
|||||||
|
|
||||||
return wbrequest
|
return wbrequest
|
||||||
|
|
||||||
|
|
||||||
def render_home_page(self, env):
|
def render_home_page(self, env):
|
||||||
# render the homepage!
|
# render the homepage!
|
||||||
if self.home_view:
|
if self.home_view:
|
||||||
|
@ -56,7 +56,8 @@ class ProxyRouter(object):
|
|||||||
self.auth_msg = routing_options.get('auth_msg',
|
self.auth_msg = routing_options.get('auth_msg',
|
||||||
'Please enter name of a collection to use for proxy mode')
|
'Please enter name of a collection to use for proxy mode')
|
||||||
|
|
||||||
self.proxy_coll_select = routing_options.get('proxy_coll_select', False)
|
self.proxy_coll_select = routing_options.get('proxy_coll_select',
|
||||||
|
False)
|
||||||
|
|
||||||
def __call__(self, env):
|
def __call__(self, env):
|
||||||
url = env['REL_REQUEST_URI']
|
url = env['REL_REQUEST_URI']
|
||||||
|
@ -160,7 +160,7 @@ class RewriteContent:
|
|||||||
first_buff=first_buff)
|
first_buff=first_buff)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _decode_buff(buff, stream, encoding): # pragma: no coverage
|
def _decode_buff(buff, stream, encoding): # pragma: no coverage
|
||||||
try:
|
try:
|
||||||
buff = buff.decode(encoding)
|
buff = buff.decode(encoding)
|
||||||
except UnicodeDecodeError, e:
|
except UnicodeDecodeError, e:
|
||||||
|
@ -81,8 +81,6 @@ class UrlRewriter(object):
|
|||||||
if new_url.startswith(self.prefix):
|
if new_url.startswith(self.prefix):
|
||||||
new_url = new_url[len(self.prefix):]
|
new_url = new_url[len(self.prefix):]
|
||||||
|
|
||||||
#new_wburl = copy.copy(self.wburl)
|
|
||||||
#new_wburl.url = new_url
|
|
||||||
new_wburl = WbUrl(new_url)
|
new_wburl = WbUrl(new_url)
|
||||||
return UrlRewriter(new_wburl, self.prefix)
|
return UrlRewriter(new_wburl, self.prefix)
|
||||||
|
|
||||||
@ -122,7 +120,6 @@ class UrlRewriter(object):
|
|||||||
|
|
||||||
parts = (scheme, netloc, path, query, frag)
|
parts = (scheme, netloc, path, query, frag)
|
||||||
|
|
||||||
|
|
||||||
new_url = urlparse.urlunsplit(parts)
|
new_url = urlparse.urlunsplit(parts)
|
||||||
return new_url
|
return new_url
|
||||||
|
|
||||||
|
@ -215,7 +215,8 @@ def create_record_iter(arcv_iter, options):
|
|||||||
not append_post):
|
not append_post):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
elif (not include_all and record.content_type == 'application/warc-fields'):
|
elif (not include_all and
|
||||||
|
record.content_type == 'application/warc-fields'):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
entry = parse_warc_record(record)
|
entry = parse_warc_record(record)
|
||||||
@ -226,7 +227,8 @@ def create_record_iter(arcv_iter, options):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if entry.url and not entry.key:
|
if entry.url and not entry.key:
|
||||||
entry.key = canonicalize(entry.url, options.get('surt_ordered', True))
|
entry.key = canonicalize(entry.url,
|
||||||
|
options.get('surt_ordered', True))
|
||||||
|
|
||||||
compute_digest = False
|
compute_digest = False
|
||||||
|
|
||||||
|
@ -77,8 +77,10 @@ class SortedCDXWriter(CDXWriter):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
#=================================================================
|
||||||
ALLOWED_EXT = ('.arc', '.arc.gz', '.warc', '.warc.gz')
|
ALLOWED_EXT = ('.arc', '.arc.gz', '.warc', '.warc.gz')
|
||||||
|
|
||||||
|
|
||||||
#=================================================================
|
#=================================================================
|
||||||
def iter_file_or_dir(inputs):
|
def iter_file_or_dir(inputs):
|
||||||
for input_ in inputs:
|
for input_ in inputs:
|
||||||
|
@ -72,7 +72,7 @@ class BaseContentView(object):
|
|||||||
embed_url = wbrequest.wb_url.to_str(mod=self._mp_mod)
|
embed_url = wbrequest.wb_url.to_str(mod=self._mp_mod)
|
||||||
timestamp = datetime_to_timestamp(datetime.datetime.utcnow())
|
timestamp = datetime_to_timestamp(datetime.datetime.utcnow())
|
||||||
url = wbrequest.wb_url.url
|
url = wbrequest.wb_url.url
|
||||||
ctype='text/html'
|
ctype = 'text/html'
|
||||||
|
|
||||||
return self.frame_insert_view.render_response(embed_url=embed_url,
|
return self.frame_insert_view.render_response(embed_url=embed_url,
|
||||||
wbrequest=wbrequest,
|
wbrequest=wbrequest,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user