From afbd66f6d94e54110faa194c6d31b61279102621 Mon Sep 17 00:00:00 2001 From: Bernardo Damele <bernardo.damele@gmail.com> Date: Thu, 18 Dec 2008 21:58:05 +0000 Subject: [PATCH] Added some comments --- lib/controller/checks.py | 4 ++++ lib/request/comparison.py | 12 +++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/controller/checks.py b/lib/controller/checks.py index 0b52d2543..6e2b98d48 100644 --- a/lib/controller/checks.py +++ b/lib/controller/checks.py @@ -306,6 +306,8 @@ def checkStability(): condition &= secondPage == thirdPage if condition == False: + # Prepare for the comparison algorithm based on Content-Length + # header value contentLengths = [] requestsHeaders = ( firstHeaders, secondHeaders, thirdHeaders ) @@ -328,6 +330,8 @@ def checkStability(): # TODO: go ahead here with the technique to compare True/False # based upon clAverage discard (conf.contentLengths) + # Prepare for the comparison algorithm based on page content's + # stable lines subset counter = 0 firstLines = firstPage.split("\n") secondLines = secondPage.split("\n") diff --git a/lib/request/comparison.py b/lib/request/comparison.py index 932923a2e..3c7ad6847 100644 --- a/lib/request/comparison.py +++ b/lib/request/comparison.py @@ -71,7 +71,13 @@ def comparison(page, headers=None, content=False): if not conf.equalLines and not conf.contentLengths: return md5.new(page).hexdigest() - # TODO: ahead here + # TODO: go ahead from here + + # Comparison algorithm based on Content-Length header value + elif conf.contentLengths: + pass + + # Comparison algorithm based on page content's stable lines subset elif conf.equalLines: counter = 0 trueLines = 0 @@ -87,8 +93,8 @@ def comparison(page, headers=None, content=False): counter += 1 # TODO: just debug prints - print "trueLines:", trueLines, "len(conf.equalLines):", len(conf.equalLines) - print "result:", ( trueLines * 100 ) / len(conf.equalLines) + #print "trueLines:", trueLines, "len(conf.equalLines):", len(conf.equalLines) + #print "result:", ( trueLines * 100 ) / len(conf.equalLines) if ( trueLines * 100 ) / len(conf.equalLines) >= 98: return True