[Zope-Checkins] CVS: Packages/OFS - PropertySheets.py:1.89.4.8

Sidnei da Silva sidnei at awkly.org
Wed Nov 3 11:52:17 EST 2004


Update of /cvs-repository/Packages/OFS
In directory cvs.zope.org:/tmp/cvs-serv25715/lib/python/OFS

Modified Files:
      Tag: Zope-2_7-branch
	PropertySheets.py 
Log Message:

      - Don't escape properties stored as XML (ie: having a
        __xml_attrs__ metadata set by PROPPATCH) when building a
        PROPFIND response.

      - If a PROPPATCH element value contains only a CDATA section,
        store the CDATA contents only.


=== Packages/OFS/PropertySheets.py 1.89.4.7 => 1.89.4.8 ===
--- Packages/OFS/PropertySheets.py:1.89.4.7	Tue Nov  2 12:24:58 2004
+++ Packages/OFS/PropertySheets.py	Wed Nov  3 11:51:46 2004
@@ -325,14 +325,14 @@
             # check for xml property
             attrs=item.get('meta', {}).get('__xml_attrs__', None)
             if attrs is not None:
+                # It's a xml property. Don't escape value.
                 attrs=map(lambda n: ' %s="%s"' % n, attrs.items())
                 attrs=''.join(attrs)
             else:
-                # Quote non-xml items here?
+                # It's a non-xml property. Escape value.
                 attrs=''
-
-            if not hasattr(self,"dav__"+name):
-                value = xml_escape(value)
+                if not hasattr(self,"dav__"+name):
+                    value = xml_escape(value)
             prop='  <n:%s%s>%s</n:%s>' % (name, attrs, value, name)
 
             result.append(prop)
@@ -376,13 +376,14 @@
             # allow for xml properties
             attrs=item.get('meta', {}).get('__xml_attrs__', None)
             if attrs is not None:
+                # It's a xml property. Don't escape value.
                 attrs=map(lambda n: ' %s="%s"' % n, attrs.items())
                 attrs=''.join(attrs)
             else:
-                # quote non-xml items here?
+                # It's a non-xml property. Escape value.
                 attrs=''
-            if not hasattr(self, 'dav__%s' % name):
-                value = xml_escape(value)
+                if not hasattr(self, 'dav__%s' % name):
+                    value = xml_escape(value)
             prop='<n:%s%s xmlns:n="%s">%s</n:%s>\n' % (
                 name, attrs, xml_id, value, name)
             code='200 OK'



More information about the Zope-Checkins mailing list