Pdata type become obsolete in this method because the data property always

returns a 'str' type


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29159 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f461e4b8
...@@ -98,29 +98,15 @@ def Base_asXML(object, root=None): ...@@ -98,29 +98,15 @@ def Base_asXML(object, root=None):
elif prop_type in ('data',): elif prop_type in ('data',):
# Create blocks to represent data # Create blocks to represent data
# <data><block>ZERD</block><block>OEJJM</block></data> # <data><block>ZERD</block><block>OEJJM</block></data>
size_block = 80 size_block = 60
if isinstance(value, str): if isinstance(value, str):
sub_object.set('type_data','str')
iterator_block = 0 iterator_block = 0
data_encoded = standard_b64encode(value) for index in xrange(0, len(value), size_block):
for index in xrange(0, len(data_encoded), size_block): content = value[index:index + size_block]
content = data_encoded[index:index + size_block] data_encoded = standard_b64encode(content)
block = SubElement(sub_object, 'block_data', num=str(iterator_block)) block = SubElement(sub_object, 'block_data', num=str(iterator_block))
block.text = content block.text = data_encoded
iterator_block += 1 iterator_block += 1
elif isinstance(value, Pdata):
# Create blocks if there is a stack of data
sub_object.set('type_data','Pdata')
data = value
iterator_block = 0
while data is not None:
data_encoded = standard_b64encode(data.data)
for index in xrange(0, len(data_encoded), size_block):
content = data_encoded[index:index + size_block]
block = SubElement(sub_object, 'block_data', num=str(iterator_block))
block.text = content
iterator_block += 1
data = data.next
else: else:
raise "XMLExportImport failed, the data is undefined" raise "XMLExportImport failed, the data is undefined"
elif prop_type in ('lines', 'tokens',): elif prop_type in ('lines', 'tokens',):
......
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