From 982700d503d38ce95ad09f18f6a87314a99e0a6f Mon Sep 17 00:00:00 2001 From: Barbara Miller Date: Wed, 14 Feb 2018 17:55:09 -0800 Subject: [PATCH] add CHAIN_POSITION support --- warcprox/controller.py | 2 ++ warcprox/writerthread.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/warcprox/controller.py b/warcprox/controller.py index 30446c3..644fdec 100644 --- a/warcprox/controller.py +++ b/warcprox/controller.py @@ -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) diff --git a/warcprox/writerthread.py b/warcprox/writerthread.py index 27c5eea..854319c 100644 --- a/warcprox/writerthread.py +++ b/warcprox/writerthread.py @@ -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: