[Zope-Checkins] CVS: Zope2 - PropertySheets.py:1.76

andreas@serenade.digicool.com andreas@serenade.digicool.com
Fri, 6 Jul 2001 14:11:25 -0400


Update of /cvs-repository/Zope2/lib/python/OFS
In directory serenade:/tmp/cvs-serv6646

Modified Files:
	PropertySheets.py 
Log Message:
updated xml_escape() from 2.4 branch



--- Updated File PropertySheets.py in package Zope2 --
--- PropertySheets.py	2001/07/05 14:54:28	1.75
+++ PropertySheets.py	2001/07/06 18:11:24	1.76
@@ -814,8 +814,10 @@
     (e.g. containing accented characters). Also we convert "<" and ">"
     to entities to keep the properties XML compliant. 
     """
-
-    v = str(v).replace('<','&lt;')
-    v = v.replace('>','&gt;')
+    v = str(v)
+    
+    if v.count('<') != v.count('>'): 
+        v = v.replace('<','&lt;')
+        v = v.replace('>','&gt;')
 
     return  unicode(v,"latin-1").encode("utf-8")