add CHAIN_POSITION support

This commit is contained in:
Barbara Miller 2018-02-14 17:55:09 -08:00
parent 46dd01de89
commit 982700d503
2 changed files with 4 additions and 2 deletions

View File

@ -212,6 +212,8 @@ class WarcproxController(object):
self._postfetch_chain.append(
warcprox.ListenerPostfetchProcessor(
plugin, self.options))
elif hasattr(plugin, 'CHAIN_POSITION') and plugin.CHAIN_POSITION == 'early':
self._postfetch_chain.insert(0, plugin) # or insert early but later than 0?
else:
self._postfetch_chain.append(plugin)

View File

@ -85,8 +85,8 @@ class WarcWriterProcessor(warcprox.BaseStandardPostfetchProcessor):
if recorded_url.do_not_archive
else False)
# special warc name prefix '-' means "don't archive"
return prefix != '-' and (not do_not_archive) and
self._filter_accepts(recorded_url)
return (prefix != '-' and (not do_not_archive)
and self._filter_accepts(recorded_url))
def _log(self, recorded_url, records):
try: