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

ooo/handler: set environment from config when bootstraping handler

This is necessary for Libreoffice 7, where uno from Libreoffice python needs
LD_LIBRARY_PATH to be set.
parent 5d383387
...@@ -300,7 +300,8 @@ def bootstrapHandler(configuration_dict): ...@@ -300,7 +300,8 @@ def bootstrapHandler(configuration_dict):
office_binary_path=configuration_dict.get('office_binary_path'), office_binary_path=configuration_dict.get('office_binary_path'),
timeout=timeout_response, timeout=timeout_response,
ooo_disable_filter_list=configuration_dict.get('ooo_disable_filter_list'), ooo_disable_filter_list=configuration_dict.get('ooo_disable_filter_list'),
ooo_disable_filter_name_list=configuration_dict.get('ooo_disable_filter_name_list')) ooo_disable_filter_name_list=configuration_dict.get('ooo_disable_filter_name_list'),
environment_dict=environment_dict)
# Load all filters # Load all filters
openoffice.acquire() openoffice.acquire()
......
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
import pkg_resources import pkg_resources
from re import findall from re import findall
from subprocess import Popen, PIPE import os
from subprocess import STDOUT import subprocess
from zope.interface import implements from zope.interface import implements
from filter import Filter from filter import Filter
from os import environ, path from os import environ, path
...@@ -89,7 +89,7 @@ class MimeMapper(object): ...@@ -89,7 +89,7 @@ class MimeMapper(object):
"""Verify if filters were loaded""" """Verify if filters were loaded"""
return self._loaded return self._loaded
def loadFilterList(self, hostname, port, **kw): def loadFilterList(self, hostname, port, environment_dict, **kw):
"""Load all filters of openoffice. """Load all filters of openoffice.
Keyword arguments: Keyword arguments:
hostname -- host of OpenOffice hostname -- host of OpenOffice
...@@ -125,12 +125,11 @@ class MimeMapper(object): ...@@ -125,12 +125,11 @@ class MimeMapper(object):
"--office_binary_path=%s" % office_binary_path, "--office_binary_path=%s" % office_binary_path,
"--hostname=%s" % hostname, "--hostname=%s" % hostname,
"--port=%s" % port] "--port=%s" % port]
filter_dict, type_dict = json.loads(
process = Popen(command, stdout=PIPE, stderr=STDOUT, close_fds=True) subprocess.check_output(
stdout, stderr = process.communicate() command,
if process.returncode: env=dict(os.environ, **environment_dict),
raise ValueError(stdout) close_fds=True))
filter_dict, type_dict = json.loads(stdout)
ooo_disable_filter_list = kw.get("ooo_disable_filter_list") or [] + [ ooo_disable_filter_list = kw.get("ooo_disable_filter_list") or [] + [
# 'writer_jpg_Export', # Seems not working from cloudooo in Libre Office 4.3.3.2 # 'writer_jpg_Export', # Seems not working from cloudooo in Libre Office 4.3.3.2
......
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