[z3-checkins] r47471 - z3/deliverance/trunk/deliverance

ianb at codespeak.net ianb at codespeak.net
Mon Oct 15 18:59:20 CEST 2007


Author: ianb
Date: Mon Oct 15 18:59:20 2007
New Revision: 47471

Modified:
   z3/deliverance/trunk/deliverance/utils.py
   z3/deliverance/trunk/deliverance/xslt.py
Log:
Replace some truth tests of elements, which actually were testing if there were no subelements when they probably meant to be testing for None

Modified: z3/deliverance/trunk/deliverance/utils.py
==============================================================================
--- z3/deliverance/trunk/deliverance/utils.py	(original)
+++ z3/deliverance/trunk/deliverance/utils.py	Mon Oct 15 18:59:20 2007
@@ -160,7 +160,7 @@
         inserts the element el into the beginning of body 
         element of the document given        
         """
-        if not el:
+        if el is None:
             return
         body = doc.find('body')
         if body is None:
@@ -427,7 +427,9 @@
         root = etree.Element("content")
 
 
-        if content: 
+        ## FIXME: this was originally "if content:", but I think it actually
+        ## was meant to catch content==None.  But I'm not sure.
+        if content is not None:
             request_doc = etree.SubElement(root,"document")
             request_doc.set("content",self.REQUEST_CONTENT)
             request_doc.append(content)

Modified: z3/deliverance/trunk/deliverance/xslt.py
==============================================================================
--- z3/deliverance/trunk/deliverance/xslt.py	(original)
+++ z3/deliverance/trunk/deliverance/xslt.py	Mon Oct 15 18:59:20 2007
@@ -110,7 +110,7 @@
             return copy.deepcopy(content)
 
         #print "TRANSFORM: %s" % etree.tostring(self.xslt_wrapper)
-        if content:
+        if content is not None:
             content = self.aggregate(self.resolve_uri, self.rules, content)
             return self.transform(content).getroot()
         else:
@@ -322,7 +322,7 @@
             return
 
         err = self.format_error("no content matched", rule)
-        if err:
+        if err is not None:
             # if the content was possibly moved, check for a marker instead of the content 
             check_xpath = self.get_content_xpath(rule)
                 


More information about the z3-checkins mailing list