Commit 62cb04c3 authored by Nicolas Delaby's avatar Nicolas Delaby

Pass open_new_view argument to enable opening same document twice.

Small refactoring for readability


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@44742 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 79963f1d
......@@ -220,14 +220,13 @@ class UnoConverter(object):
fieldname = document_info.getUserFieldName(number)
metadata[fieldname] = field_value_str
service_manager = helper_utils.getServiceManager(self.hostname, self.port)
type_detection = service_manager.createInstance("com.sun.star.document.TypeDetection")
uno_file_access = service_manager.createInstance("com.sun.star.ucb.SimpleFileAccess")
doc = uno_file_access.openFileRead(self.systemPathToFileUrl(self.document_url))
property_list = []
property = self._createProperty("InputStream", doc)
property_list.append(property)
type_detection = service_manager.createInstance("com.sun.star.document.TypeDetection")
filter_name = type_detection.queryTypeByDescriptor(tuple(property_list), \
True)[0]
input_stream = self._createProperty("InputStream", doc)
open_new_view = self._createProperty("OpenNewView", True)
filter_name = type_detection.queryTypeByDescriptor((input_stream,
open_new_view), True)[0]
doc.closeInput()
metadata['MIMEType'] = mimemapper["mimetype_by_filter_type"].get(filter_name)
return metadata
......
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