From 0072c3af8e0fb9530dd325c82d21c97b186ec106 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Tue, 24 May 2011 15:03:21 +0000 Subject: [PATCH] fix for a bug reported by aboynes@gmail.com (for elt in self.a) --- doc/THANKS | 2 +- lib/request/comparison.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/THANKS b/doc/THANKS index 106f2ca60..86915b631 100644 --- a/doc/THANKS +++ b/doc/THANKS @@ -31,7 +31,7 @@ Daniele Bellucci 2006 Anthony Boynes - for reporting a bug + for reporting few bugs Velky Brat for suggesting a minor enhancement to the bisection algorithm diff --git a/lib/request/comparison.py b/lib/request/comparison.py index 30b17df4f..27f5cf895 100644 --- a/lib/request/comparison.py +++ b/lib/request/comparison.py @@ -72,7 +72,10 @@ def comparison(page, getRatioValue=False, pageLength=None): else: seqMatcher.set_seq1(getFilteredPageContent(seqMatcher.a, True) if conf.textOnly else seqMatcher.a) seqMatcher.set_seq2(getFilteredPageContent(page, True) if conf.textOnly else page) - ratio = round(seqMatcher.quick_ratio(), 3) + if seqMatcher.a is None or seqMatcher.b is None: + ratio = None + else: + ratio = round(seqMatcher.quick_ratio(), 3) # If the url is stable and we did not set yet the match ratio and the # current injected value changes the url page content