Some more improvements in the marshall/unmarshall methods.
This commit is contained in:
parent
599396a838
commit
741f760bb5
|
@ -79,4 +79,18 @@ class PodError(Exception):
|
||||||
buffer.write('</%s>' % subTag.elem)
|
buffer.write('</%s>' % subTag.elem)
|
||||||
buffer.write('</%s>' % withinElement.OD.elem)
|
buffer.write('</%s>' % withinElement.OD.elem)
|
||||||
dump = staticmethod(dump)
|
dump = staticmethod(dump)
|
||||||
|
|
||||||
|
def convertToXhtml(s):
|
||||||
|
'''Produces the XHTML-friendly version of p_s.'''
|
||||||
|
res = ''
|
||||||
|
for c in s:
|
||||||
|
if XML_SPECIAL_CHARS.has_key(c):
|
||||||
|
res += XML_SPECIAL_CHARS[c]
|
||||||
|
elif c == '\n':
|
||||||
|
res += '<br/>'
|
||||||
|
elif c == '\r':
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
res += c
|
||||||
|
return res
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
|
@ -307,9 +307,9 @@ class XmlMarshaller:
|
||||||
if value:
|
if value:
|
||||||
if type(value) in self.sequenceTypes:
|
if type(value) in self.sequenceTypes:
|
||||||
for elem in value:
|
for elem in value:
|
||||||
self.dumpField(res, 'url', elem.absolute_url_path())
|
self.dumpField(res, 'url', elem.absolute_url())
|
||||||
else:
|
else:
|
||||||
self.dumpField(res, 'url', value.absolute_url_path())
|
self.dumpField(res, 'url', value.absolute_url())
|
||||||
elif type(value) in self.sequenceTypes:
|
elif type(value) in self.sequenceTypes:
|
||||||
# The previous condition must be checked before this one because
|
# The previous condition must be checked before this one because
|
||||||
# Referred objects may be stored in lists or tuples, too.
|
# Referred objects may be stored in lists or tuples, too.
|
||||||
|
|
Loading…
Reference in a new issue