[Zope-Checkins] CVS: Zope2 - PropertySheets.py:1.74.4.4
andreas@serenade.digicool.com
andreas@serenade.digicool.com
Thu, 5 Jul 2001 10:53:23 -0400
Update of /cvs-repository/Zope2/lib/python/OFS
In directory serenade:/tmp/cvs-serv25618/lib/python/OFS
Modified Files:
Tag: Zope-2_4-branch
PropertySheets.py
Log Message:
some cleanup
--- Updated File PropertySheets.py in package Zope2 --
--- PropertySheets.py 2001/06/29 16:31:10 1.74.4.3
+++ PropertySheets.py 2001/07/05 14:53:22 1.74.4.4
@@ -376,18 +376,8 @@
# Quote non-xml items here?
attrs=''
- # Argh....a litte Hack: some webdav client don't expect
- # some object properties inside CDATA sections (GoLive !).
- # For these properties we don't use a CDATA section
-
- if name in ['creationdate', 'displayname','resourcetype','getcontenttype', \
- 'getcontentlength', 'source', 'supportedlock','lockdiscovery',
- 'getlastmodified' ] :
+ prop=' <n:%s%s>%s</n:%s>' % (name, attrs, xml_escape(value), name)
- prop=' <n:%s%s>%s</n:%s>' % (name, attrs, xml_escape(value), name)
- else:
- prop=' <n:%s%s><![CDATA[%s]]></n:%s>' % (name, attrs, xml_escape(value), name)
-
result.append(prop)
if not result: return ''
result=join(result, '\n')
@@ -821,9 +811,11 @@
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). Although the property
- values are put inside a CDATA section MSIE 6 is unable to handle
- this correctly).
+ (e.g. containing accented characters). Also we convert "<" and ">"
+ to entities to keep the properties XML compliant.
"""
+
+ v = str(v).replace('<','<')
+ v = v.replace('>','>')
- return unicode(str(v),"latin-1").encode("utf-8")
+ return unicode(v,"latin-1").encode("utf-8")