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):
office_binary_path=configuration_dict.get('office_binary_path'),
timeout=timeout_response,
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
openoffice.acquire()
......
......@@ -30,8 +30,8 @@
import pkg_resources
from re import findall
from subprocess import Popen, PIPE
from subprocess import STDOUT
import os
import subprocess
from zope.interface import implements
from filter import Filter
from os import environ, path
......@@ -89,7 +89,7 @@ class MimeMapper(object):
"""Verify if filters were loaded"""
return self._loaded
def loadFilterList(self, hostname, port, **kw):
def loadFilterList(self, hostname, port, environment_dict, **kw):
"""Load all filters of openoffice.
Keyword arguments:
hostname -- host of OpenOffice
......@@ -125,12 +125,11 @@ class MimeMapper(object):
"--office_binary_path=%s" % office_binary_path,
"--hostname=%s" % hostname,
"--port=%s" % port]
process = Popen(command, stdout=PIPE, stderr=STDOUT, close_fds=True)
stdout, stderr = process.communicate()
if process.returncode:
raise ValueError(stdout)
filter_dict, type_dict = json.loads(stdout)
filter_dict, type_dict = json.loads(
subprocess.check_output(
command,
env=dict(os.environ, **environment_dict),
close_fds=True))
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
......
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