[cpif] r202 - trunk/frontend-web

svn at argo.es svn at argo.es
Fri Jun 29 21:26:40 CEST 2007


Author: alvaro
Date: Fri Jun 29 21:26:39 2007
New Revision: 202

Log:
Bugfix


Modified:
   trunk/frontend-web/parsers.py

Modified: trunk/frontend-web/parsers.py
==============================================================================
--- trunk/frontend-web/parsers.py	(original)
+++ trunk/frontend-web/parsers.py	Fri Jun 29 21:26:39 2007
@@ -8,8 +8,7 @@
 from parser_html import escape
 
 def convert_to_html(text):
-  from globales import allow_bbcode,allow_html
-
+  from globales import allow_bbcode, allow_html
   if allow_html:
     parser = parser_html.HTMLParser()
     parser.reset()
@@ -19,14 +18,14 @@
       if not text: raise parser_html.SGMLParseError, "HTML no valido"
     except parser_html.SGMLParseError, e:
       return e or "HTML no valido", None
+  else:
+    text = escape(text)
 
   if allow_bbcode:
     parser = parser_bbcode.BBCodeParser()
     parser.feed(text)
     return parser.parse()
   
-  text = escape(text)
-
   return False, text
 
 class TestHTMLParser(unittest.TestCase):
@@ -231,10 +230,10 @@
       list.append(code)
       retval, result = convert_to_html(code)
       assert not retval
-      self.assertEqual(escape(code),result)
+      self.assertEqual(code,result)
     retval, result = convert_to_html("".join(list))
     assert not retval
-    self.assertEqual(escape("".join(list)),result)
+    self.assertEqual("".join(list),result)
 
   def test_NoBBCodeNoHTML(self):
     list = []



More information about the cpif mailing list