[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r18304: {torflow} Dag, we were still killing subtress. Also, compare strings o (torflow/trunk/NetworkScanners)



Author: mikeperry
Date: 2009-01-28 13:02:21 -0500 (Wed, 28 Jan 2009)
New Revision: 18304

Modified:
   torflow/trunk/NetworkScanners/soat.py
Log:

Dag, we were still killing subtress. Also, compare strings of
soups, not soup objects.



Modified: torflow/trunk/NetworkScanners/soat.py
===================================================================
--- torflow/trunk/NetworkScanners/soat.py	2009-01-28 17:36:41 UTC (rev 18303)
+++ torflow/trunk/NetworkScanners/soat.py	2009-01-28 18:02:21 UTC (rev 18304)
@@ -707,7 +707,7 @@
     for tag in tags_to_recurse:
       tags = soup.findAll(tag)
       for t in tags:
-        plog("DEBUG", "Got tag: "+str(t))
+        #plog("DEBUG", "Got tag: "+str(t))
         for a in t.attrs:
           attr_name = str(a[0])
           attr_tgt = str(a[1])
@@ -753,6 +753,11 @@
           if not isinstance(child, Tag) or self._tag_not_worthy(child):
             to_extract.append(child)
     for tag in to_extract:
+      if isinstance(tag, Tag):
+        parent = tag.findParent()
+        for child in tag.findChildren():
+          parent.append(child)
+    for tag in to_extract:
       tag.extract()
     return soup      
  
@@ -850,7 +855,7 @@
 
     # compare the content
     # if content matches, everything is ok
-    if psoup == soup:
+    if str(psoup) == str(soup):
       result = HtmlTestResult(exit_node, address, TEST_SUCCESS)
       self.results.append(result)
       #self.datahandler.saveResult(result)
@@ -873,7 +878,7 @@
                                      parseOnlyThese=elements))
     # compare the new and old content
     # if they match, means the node has been changing the content
-    if soup == soup_new:
+    if str(soup) == str(soup_new):
       # XXX: Check for existence of this file before overwriting
       exit_tag_file = open(failed_prefix+'.tags.'+exit_node[1:],'w')
       exit_tag_file.write(str(psoup))
@@ -912,7 +917,7 @@
 
     # compare the node content and the new content
     # if it matches, everything is ok
-    if psoup == soup_new:
+    if str(psoup) == str(soup_new):
       result = HtmlTestResult(exit_node, address, TEST_SUCCESS)
       self.results.append(result)
       #self.datahandler.saveResult(result)