[z3-checkins] r33281 - z3/deliverance/branches/packaged/deliverance

ianb at codespeak.net ianb at codespeak.net
Sat Oct 14 03:19:03 CEST 2006


Author: ianb
Date: Sat Oct 14 03:18:50 2006
New Revision: 33281

Modified:
   z3/deliverance/branches/packaged/deliverance/utils.py
Log:
Added new key, NOCONTENT_KEY; warn if the version of libxml2 isn't new enough to parse <script> in HTML properly

Modified: z3/deliverance/branches/packaged/deliverance/utils.py
==============================================================================
--- z3/deliverance/branches/packaged/deliverance/utils.py	(original)
+++ z3/deliverance/branches/packaged/deliverance/utils.py	Sat Oct 14 03:18:50 2006
@@ -3,6 +3,13 @@
 import urlparse
 import htmlserialize
 
+# Test if the libxml2 fix is in place
+html = etree.HTML('<html><head><script>some text</script></head></html>')
+if html[0][0].text != 'some text':
+    import warnings
+    warnings.warn(
+        'Deliverance requires the CVS HEAD version of libxml2')
+
 class RuleSyntaxError(Exception):
     """
     Raised when an invalid or unknown rule is encountered by a renderer 
@@ -32,6 +39,8 @@
     RULE_CONTENT_KEY = "content"
     RULE_THEME_KEY   = "theme" 
 
+    NOCONTENT_KEY = "nocontent"
+
     def get_theme_el(self,rule,theme):
         theme_els = theme.xpath(rule.attrib[self.RULE_THEME_KEY])
         if len(theme_els)== 0:
@@ -118,8 +127,8 @@
 
         Affects urls in href attributes, src attributes and 
         css of the form url(...) in style elements 
-        """        
-        base_uri = uri 
+        """
+        base_uri = uri
         basetags = doc.xpath('//base[@href]')
         if (len(basetags)):
             base_uri = basetags[0].attrib['href']


More information about the z3-checkins mailing list