From 1420759818bf64bb9c36419bfa328bc30dba642a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Mon, 14 May 2007 17:01:00 +0000 Subject: [PATCH] Compatibility with old oood version git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14485 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5OOo/Document/OOoDocument.py | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/product/ERP5OOo/Document/OOoDocument.py b/product/ERP5OOo/Document/OOoDocument.py index 57a733fcea..78e141a66a 100644 --- a/product/ERP5OOo/Document/OOoDocument.py +++ b/product/ERP5OOo/Document/OOoDocument.py @@ -185,14 +185,25 @@ class OOoDocument(File, ConversionCacheMixin): def cached_getTargetFormatItemList(content_type): server_proxy = self._mkProxy() 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: allowed = response_dict['response_data'] else: # This is very temporary code - XXX needs to be changed # 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)) + except Fault, f: allowed = server_proxy.getAllowedTargets(content_type) warn('Your oood version is too old, using old method ' @@ -251,10 +262,18 @@ class OOoDocument(File, ConversionCacheMixin): z.close() return 'text/plain', s 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())), None, 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 return response_dict['mime'], Pdata(dec(response_dict['data'])) -- 2.30.9