From 44678fa3201626f9b685839c5c3edc87ee22ccd0 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Wed, 3 Nov 2010 12:40:11 +0000 Subject: [PATCH] fix for a bug reported by ToR (TypeError: unsupported operand type(s) for *: 'float' and 'NoneType') --- lib/request/comparison.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/request/comparison.py b/lib/request/comparison.py index 5a4e311bd..cd5b8ea61 100644 --- a/lib/request/comparison.py +++ b/lib/request/comparison.py @@ -58,10 +58,13 @@ def comparison(page, headers=None, getSeqMatcher=False, pageLength=None): else: page = re.sub('(?s)%s.+%s' % (prefix, postfix), '%s%s' % (prefix, postfix), page) + if not pageLength and page: + pageLength = len(page) + if kb.locks.seqLock: kb.locks.seqLock.acquire() - if not conf.eRegexp and not conf.eString and kb.nullConnection: + if not conf.eRegexp and not conf.eString and kb.nullConnection and pageLength: ratio = 1. * pageLength / len(conf.seqMatcher.a) if ratio > 1.: ratio = 1. / ratio