From 5db26384556be4d7cee3ba93dfc6375c8d80b6ea Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Sun, 2 Dec 2018 10:57:26 +0100 Subject: controller: Add only enabled behavior scripts to warcinfo --- crocoite/controller.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crocoite/controller.py b/crocoite/controller.py index 8b25d1f..22e7e28 100644 --- a/crocoite/controller.py +++ b/crocoite/controller.py @@ -137,6 +137,10 @@ class SinglePageController: start = time.time () + # not all behavior scripts are allowed for every URL, filter them + enabledBehavior = list (filter (lambda x: self.url in x, + map (lambda x: x (l, logger), self.behavior))) + version = await l.tab.Browser.getVersion () payload = { 'software': { @@ -157,15 +161,11 @@ class SinglePageController: 'url': self.url, 'idleTimeout': self.settings.idleTimeout, 'timeout': self.settings.timeout, - 'behavior': list (map (attrgetter('name'), self.behavior)), + 'behavior': list (map (attrgetter('name'), enabledBehavior)), }, } self.processItem (ControllerStart (payload)) - # not all behavior scripts are allowed for every URL, filter them - enabledBehavior = list (filter (lambda x: self.url in x, - map (lambda x: x (l, logger), self.behavior))) - await l.start () for b in enabledBehavior: async for item in b.onload (): -- cgit v1.2.3