[Zope-Checkins] CVS: Packages/OFS - Image.py:1.145.2.9
	PropertySheets.py:1.89.4.7
    Sidnei da Silva 
    sidnei at awkly.org
       
    Tue Nov  2 12:25:28 EST 2004
    
    
  
Update of /cvs-repository/Packages/OFS
In directory cvs.zope.org:/tmp/cvs-serv15504/lib/python/OFS
Modified Files:
      Tag: Zope-2_7-branch
	Image.py PropertySheets.py 
Log Message:
      - Always unescape element contents on webdav.xmltools
      - Use saxutils to escape/unescape values for/from
        PROPFIND/PROPPATCH.
      - Make OFS.PropertySheet use the escaping function from
        webdav.xmltools.
      - Escape/unescape " and '
      - Set a default value of '' for the new 'alt' property as not to
        break existing content.
=== Packages/OFS/Image.py 1.145.2.8 => 1.145.2.9 ===
--- Packages/OFS/Image.py:1.145.2.8	Sat Oct 30 03:35:39 2004
+++ Packages/OFS/Image.py	Tue Nov  2 12:24:58 2004
@@ -76,6 +76,7 @@
 
     precondition=''
     size=None
+    alt=''
 
     manage_editForm  =DTMLFile('dtml/fileEdit',globals(),
                                Kind='File',kind='file')
=== Packages/OFS/PropertySheets.py 1.89.4.6 => 1.89.4.7 ===
--- Packages/OFS/PropertySheets.py:1.89.4.6	Wed Mar 31 10:57:18 2004
+++ Packages/OFS/PropertySheets.py	Tue Nov  2 12:24:58 2004
@@ -808,15 +808,12 @@
         return attr()
     return attr
 
-
-def xml_escape(v):
-    """ convert any content from ISO-8859-1 to UTF-8
-    The main use is to escape non-US object property values
-    (e.g. containing accented characters). Also we convert "<" and ">"
-    to entities to keep the properties XML compliant.
-    """
-    v = str(v)
-    v = v.replace('&', '&')
-    v = v.replace('<', '<')
-    v = v.replace('>', '>')
-    return  unicode(v,"latin-1").encode("utf-8")
+def xml_escape(value):
+    from webdav.xmltools import escape
+    if not isinstance(value, basestring):
+        value = unicode(value)
+    if not isinstance(value, unicode):
+        # XXX It really shouldn't be hardcoded to latin-1 here.
+        value = value.decode('latin-1')
+    value = escape(value)
+    return value.encode('utf-8')
    
    
More information about the Zope-Checkins
mailing list