Commit 14207598 authored by Jérome Perrin's avatar Jérome Perrin

Compatibility with old oood version

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14485 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c3f5fd8f
...@@ -185,14 +185,25 @@ class OOoDocument(File, ConversionCacheMixin): ...@@ -185,14 +185,25 @@ class OOoDocument(File, ConversionCacheMixin):
def cached_getTargetFormatItemList(content_type): def cached_getTargetFormatItemList(content_type):
server_proxy = self._mkProxy() server_proxy = self._mkProxy()
try: try:
response_code, response_dict, response_message = server_proxy.getAllowedTargetItemList(content_type) allowed_target_item_list = server_proxy.getAllowedTargetItemList(
content_type)
try:
response_code, response_dict, response_message = \
allowed_target_item_list
except ValueError:
# Compatibility with older oood where getAllowedTargetItemList only
# returned response_dict
response_code, response_dict, response_message = \
200, dict(response_data=allowed_target_item_list), ''
if response_code == 200: if response_code == 200:
allowed = response_dict['response_data'] allowed = response_dict['response_data']
else: else:
# This is very temporary code - XXX needs to be changed # This is very temporary code - XXX needs to be changed
# so that the system can retry # so that the system can retry
raise ConversionError("[DMS] Can not get list of allowed acceptable formats for conversion: %s (%s)" raise ConversionError("[DMS] Can not get list of allowed acceptable formats for conversion: %s (%s)"
%(response_code, response_message)) %(response_code, response_message))
except Fault, f: except Fault, f:
allowed = server_proxy.getAllowedTargets(content_type) allowed = server_proxy.getAllowedTargets(content_type)
warn('Your oood version is too old, using old method ' warn('Your oood version is too old, using old method '
...@@ -251,10 +262,18 @@ class OOoDocument(File, ConversionCacheMixin): ...@@ -251,10 +262,18 @@ class OOoDocument(File, ConversionCacheMixin):
z.close() z.close()
return 'text/plain', s return 'text/plain', s
server_proxy = self._mkProxy() server_proxy = self._mkProxy()
response_code, response_dict, response_message = server_proxy.run_generate(self.getId(),
generate_result = server_proxy.run_generate(self.getId(),
enc(_unpackData(self.getBaseData())), enc(_unpackData(self.getBaseData())),
None, None,
format) format)
try:
response_code, response_dict, response_message = generate_result
except ValueError:
# This is for backward compatibility with older oood version returning
# only response_dict
response_dict = generate_result
# XXX: handle possible OOOd server failure # XXX: handle possible OOOd server failure
return response_dict['mime'], Pdata(dec(response_dict['data'])) return response_dict['mime'], Pdata(dec(response_dict['data']))
......
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