From 745e6cc942ee411f09565386cad4def5f638f68b Mon Sep 17 00:00:00 2001 From: Barbara Miller Date: Mon, 19 Mar 2018 16:28:14 -0700 Subject: [PATCH 1/3] log behavior params better --- brozzler/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/brozzler/__init__.py b/brozzler/__init__.py index 7f068ba..06f3d0c 100644 --- a/brozzler/__init__.py +++ b/brozzler/__init__.py @@ -105,7 +105,7 @@ def behavior_script(url, template_parameters=None, behaviors_dir=None): ''' Returns the javascript behavior string populated with template_parameters. ''' - import re, logging + import re, logging, json for behavior in behaviors(behaviors_dir=behaviors_dir): if re.match(behavior['url_regex'], url): parameters = dict() @@ -118,7 +118,7 @@ def behavior_script(url, template_parameters=None, behaviors_dir=None): script = template.render(parameters) logging.info( 'using template=%r populated with parameters=%r for %r', - behavior['behavior_js_template'], parameters, url) + behavior['behavior_js_template'], json.dumps(parameters), url) return script return None From bc5a36e8a373e8f29c98a928b173b28613d2bee2 Mon Sep 17 00:00:00 2001 From: Barbara Miller Date: Mon, 19 Mar 2018 16:28:47 -0700 Subject: [PATCH 2/3] better booleans --- brozzler/behaviors.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/brozzler/behaviors.yaml b/brozzler/behaviors.yaml index dc2a038..3f082c1 100644 --- a/brozzler/behaviors.yaml +++ b/brozzler/behaviors.yaml @@ -28,9 +28,9 @@ interval: 2500 actions: - selector: div.see-more - firstMatchOnly: 1 + firstMatchOnly: true - selector: li.next - repeatSameElement: 1 + repeatSameElement: true - url_regex: '^https?://(?:www\.)?marquette\.edu/.*$' behavior_js_template: marquette_edu.js From 1e2e7213c8af0064c02c50d9946d13acc254fd1b Mon Sep 17 00:00:00 2001 From: Barbara Miller Date: Mon, 19 Mar 2018 16:31:23 -0700 Subject: [PATCH 3/3] better booleans for umbraBehavior --- brozzler/js-templates/umbraBehavior.js.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/brozzler/js-templates/umbraBehavior.js.j2 b/brozzler/js-templates/umbraBehavior.js.j2 index 7bc8a84..6f0fb91 100644 --- a/brozzler/js-templates/umbraBehavior.js.j2 +++ b/brozzler/js-templates/umbraBehavior.js.j2 @@ -33,8 +33,8 @@ class UmbraBehavior { // should match older default and simpleclicks behavior, and more var k = this.index; var selector = this.actions[k].selector; - var repeatSameElement = this.actions[k].repeatSameElement ? this.actions[k].repeatSameElement != false : false; - var firstMatchOnly = this.actions[k].firstMatchOnly ? this.actions[k].firstMatchOnly != false: false; + var repeatSameElement = this.actions[k].repeatSameElement ? this.actions[k].repeatSameElement : false; + var firstMatchOnly = this.actions[k].firstMatchOnly ? this.actions[k].firstMatchOnly : false; var action = this.actions[k].do ? this.actions[k].do : 'click'; var closeSelector = this.actions[k].closeSelector ? this.actions[k].closeSelector : null; var didSomething = false;