[Checkins] SVN: Sandbox/malthe/chameleon.html/ Fixed bug where CSS-comments would lead to an exception.

Malthe Borch mborch at gmail.com
Thu Oct 2 20:44:15 EDT 2008


Log message for revision 91684:
  Fixed bug where CSS-comments would lead to an exception.

Changed:
  U   Sandbox/malthe/chameleon.html/CHANGES.txt
  U   Sandbox/malthe/chameleon.html/src/chameleon/html/tests/layouts/example.xss
  U   Sandbox/malthe/chameleon.html/src/chameleon/html/xss.py

-=-
Modified: Sandbox/malthe/chameleon.html/CHANGES.txt
===================================================================
--- Sandbox/malthe/chameleon.html/CHANGES.txt	2008-10-03 00:24:55 UTC (rev 91683)
+++ Sandbox/malthe/chameleon.html/CHANGES.txt	2008-10-03 00:44:14 UTC (rev 91684)
@@ -4,6 +4,9 @@
 Head
 ~~~~
 
+- Comments are now ignored (previously an exception would be
+  raised). [malthe]
+
 chameleon.html 0.2 (released 9/25/2008)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

Modified: Sandbox/malthe/chameleon.html/src/chameleon/html/tests/layouts/example.xss
===================================================================
--- Sandbox/malthe/chameleon.html/src/chameleon/html/tests/layouts/example.xss	2008-10-03 00:24:55 UTC (rev 91683)
+++ Sandbox/malthe/chameleon.html/src/chameleon/html/tests/layouts/example.xss	2008-10-03 00:44:14 UTC (rev 91684)
@@ -1,3 +1,5 @@
+/* title */
+
 html > head title {
   name: title;
 }

Modified: Sandbox/malthe/chameleon.html/src/chameleon/html/xss.py
===================================================================
--- Sandbox/malthe/chameleon.html/src/chameleon/html/xss.py	2008-10-03 00:24:55 UTC (rev 91683)
+++ Sandbox/malthe/chameleon.html/src/chameleon/html/xss.py	2008-10-03 00:44:14 UTC (rev 91684)
@@ -22,6 +22,10 @@
 
     parser = CSSParser(loglevel=0)
     for rule in parser.parseFile(stream):
+        # ignore comments,
+        if rule.type == -1:
+            continue
+        
         properties = {}
         for prop in rule.style:
             properties[str(prop.name)] = prop.value



More information about the Checkins mailing list