From 131789a6e4729368af307669c3c0ee51d9d81624 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Fri, 14 May 2010 14:21:13 +0000 Subject: [PATCH] some code refactoring --- lib/request/comparison.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/lib/request/comparison.py b/lib/request/comparison.py index 6e15ee594..ef02ef690 100644 --- a/lib/request/comparison.py +++ b/lib/request/comparison.py @@ -53,17 +53,11 @@ def comparison(page, headers=None, getSeqMatcher=False): # String to match in page when the query is valid if conf.string: - if conf.string in page: - return True - else: - return False + return conf.string in page # Regular expression to match in page when the query is valid if conf.regexp: - if re.search(conf.regexp, page, re.I | re.M): - return True - else: - return False + return re.search(conf.regexp, page, re.I | re.M) is not None if conf.seqLock: conf.seqLock.acquire() @@ -102,7 +96,5 @@ def comparison(page, headers=None, getSeqMatcher=False): # If the url is not stable it returns sequence matcher between the # first untouched HTTP response page content and this content - elif ratio > conf.matchRatio: - return True else: - return False + return ratio > conf.matchRatio