fix for a bug reported by ToR (TypeError: unsupported operand type(s) for *: 'float' and 'NoneType')

This commit is contained in:
Miroslav Stampar 2010-11-03 12:40:11 +00:00
parent effd712ecf
commit 44678fa320

View File

@ -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