Commit 0efd04c4 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

support updating tuple property in setMetadata.

also keep backward compatibility with a whitespace separated string that is provided by old ERP5 code.
parent 7e221943
...@@ -235,7 +235,15 @@ class UnoConverter(object): ...@@ -235,7 +235,15 @@ class UnoConverter(object):
new_properties = [] new_properties = []
for prop, value in metadata.items(): for prop, value in metadata.items():
for container in [document_properties, user_defined_properties]: for container in [document_properties, user_defined_properties]:
if getattr(container, prop, None) is not None: current_value = getattr(container, prop, None)
if current_value is not None:
if isinstance(current_value, tuple):
if isinstance(value, list):
value = tuple(value)
elif isinstance(value, basestring):
# BBB: old ERP5 code sends Keywords as a string
# separated by a whitespace.
value = tuple(value.split(' '))
setattr(container, prop, value) setattr(container, prop, value)
break break
else: else:
......
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