diff tools.py @ 5:d310e097c6de tip

Replace & with &
author Thinker K.F. Li <thinker@codemud.net>
date Sun, 02 Feb 2014 22:12:15 +0800
parents 1727286834b5
children
line wrap: on
line diff
--- a/tools.py	Fri Oct 29 17:49:10 2010 +0800
+++ b/tools.py	Sun Feb 02 22:12:15 2014 +0800
@@ -82,7 +82,7 @@
 	self._committed = False
 	self._ready = False
 	pass
-    
+
     def __exit__(self, exc_type, exc_value, traceback):
 	if self._committed:
 	    self._root({}, self._rootns)
@@ -127,7 +127,7 @@
 	import types
 	if not (isinstance(data, types.StringTypes) and self.safe):
 	    return str(data)
-	return str(data.replace('<', '&lt;').replace('>', '&gt;'))
+	return str(data.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;'))
     
     def _esc_cdata(self, data):
 	import types