Commit 43a69d36 authored by Fabien Morin's avatar Fabien Morin

converting value to string make not possible to use list

In some cases, we may want to use lists (like in parallel list fields), so it's
not good to always value to string. If a conversion (with '\n' addition and
'\r' replacement) is needed, this should be done in the render_od* method

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31525 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3d5ad4e0
...@@ -1030,13 +1030,8 @@ class ODGStrategy(ODFStrategy): ...@@ -1030,13 +1030,8 @@ class ODGStrategy(ODFStrategy):
text_xpath = '//draw:frame[@draw:name="%s"]' % field.id text_xpath = '//draw:frame[@draw:name="%s"]' % field.id
node_list = element_tree.xpath(text_xpath, namespaces=element_tree.nsmap) node_list = element_tree.xpath(text_xpath, namespaces=element_tree.nsmap)
value = field.get_value('default') value = field.get_value('default')
if isinstance(value, (str, unicode)):
if isinstance(value, str): if isinstance(value, str):
value = value.decode('utf-8') value = value.decode('utf-8')
value = [value]
if isinstance(value, (list, tuple)):
value = '\n'.join(value)
value.replace('\r', '')
for target_node in node_list: for target_node in node_list:
# render the field in odg xml node format # render the field in odg xml node format
attr_dict = {} attr_dict = {}
......
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