1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +01:00

not_found: catch NotFoundException from any part of handle_request, not just indexing.. allows for more flexible

usage with cdx iterators that are lazily evaluated on replay
This commit is contained in:
Ilya Kreymer 2015-02-10 15:03:21 -08:00
parent 148651680a
commit 90aba00ca0

View File

@ -69,7 +69,10 @@ class SearchPageWbUrlHandler(WbUrlHandler):
else:
wbrequest.final_mod = 'tf_'
return self.handle_request(wbrequest)
try:
return self.handle_request(wbrequest)
except NotFoundException as nfe:
return self.handle_not_found(wbrequest, nfe)
def get_top_frame_params(self, wbrequest, mod=''):
embed_url = wbrequest.wb_url.to_str(mod=mod, url='')
@ -133,10 +136,7 @@ class WBHandler(SearchPageWbUrlHandler):
self.fallback_handler = handler_dict.get(self.fallback_name)
def handle_request(self, wbrequest):
try:
cdx_lines, output = self.index_reader.load_for_request(wbrequest)
except NotFoundException as nfe:
return self.handle_not_found(wbrequest, nfe)
cdx_lines, output = self.index_reader.load_for_request(wbrequest)
if output != 'text' and wbrequest.wb_url.is_replay():
return self.handle_replay(wbrequest, cdx_lines)