Commit e0626a9b authored by Brian Lloyd's avatar Brian Lloyd

Fixed PROPFIND xml generation for 'tokens' properties and fixed xml

escaping logic.
parent 616dbe2c
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
############################################################################## ##############################################################################
"""Property sheets""" """Property sheets"""
__version__='$Revision: 1.76 $'[11:-2] __version__='$Revision: 1.77 $'[11:-2]
import time, string, App.Management, Globals import time, string, App.Management, Globals
from webdav.WriteLockInterface import WriteLockInterface from webdav.WriteLockInterface import WriteLockInterface
...@@ -364,9 +364,9 @@ class PropertySheet(Traversable, Persistent, Implicit): ...@@ -364,9 +364,9 @@ class PropertySheet(Traversable, Persistent, Implicit):
name, type=item['id'], item.get('type','string') name, type=item['id'], item.get('type','string')
value=self.getProperty(name) value=self.getProperty(name)
if type=='tokens': if type=='tokens':
value=join(value, ' ') value=join(str(value), ' ')
elif type=='lines': elif type=='lines':
value=join(value, '\n') value=join(str(value), '\n')
# check for xml property # check for xml property
attrs=item.get('meta', {}).get('__xml_attrs__', None) attrs=item.get('meta', {}).get('__xml_attrs__', None)
if attrs is not None: if attrs is not None:
...@@ -414,9 +414,9 @@ class PropertySheet(Traversable, Persistent, Implicit): ...@@ -414,9 +414,9 @@ class PropertySheet(Traversable, Persistent, Implicit):
name, type=item['id'], item.get('type','string') name, type=item['id'], item.get('type','string')
value=self.getProperty(name) value=self.getProperty(name)
if type=='tokens': if type=='tokens':
value=join(value, ' ') value=join(str(value), ' ')
elif type=='lines': elif type=='lines':
value=join(value, '\n') value=join(str(value), '\n')
# allow for xml properties # allow for xml properties
attrs=item.get('meta', {}).get('__xml_attrs__', None) attrs=item.get('meta', {}).get('__xml_attrs__', None)
if attrs is not None: if attrs is not None:
...@@ -815,9 +815,7 @@ def xml_escape(v): ...@@ -815,9 +815,7 @@ def xml_escape(v):
to entities to keep the properties XML compliant. to entities to keep the properties XML compliant.
""" """
v = str(v) v = str(v)
v = v.replace('&', '&')
if v.count('<') != v.count('>'): v = v.replace('<', '&lt;')
v = v.replace('<','&lt;') v = v.replace('>', '&gt;')
v = v.replace('>','&gt;')
return unicode(v,"latin-1").encode("utf-8") return unicode(v,"latin-1").encode("utf-8")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment