Commit cac3f56e authored by Gabriel Monnerat's avatar Gabriel Monnerat

clean code. remove unused Imports and refactor to use sys.executable instead of local_config

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@37868 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b0a01c59
......@@ -200,7 +200,7 @@ def main():
"hostname=", "port=", "source_format=",
"document_url=", "destination_format=",
"mimemapper=", "metadata=",
"unomimemapper_bin=", "python_path="])
"unomimemapper_bin="])
except GetoptError, msg:
msg = msg.msg + help_msg
usage(sys.stderr, msg)
......@@ -233,8 +233,6 @@ def main():
mimemapper = jsonpickle.decode(arg)
elif opt == '--unomimemapper_bin':
unomimemapper_bin = arg
elif opt == '--python_path':
python_path = arg
kw = {}
......@@ -249,9 +247,7 @@ def main():
if "unomimemapper_bin" in locals():
kw['unomimemapper_bin'] = unomimemapper_bin
if "python_path" in locals():
kw['python_path'] = python_path
kw['python_path'] = executable
mimemapper.loadFilterList(hostname=hostname, port=port, **kw)
kw.clear()
......@@ -259,8 +255,6 @@ def main():
kw['source_format'] = source_format
unoconverter = UnoConverter(hostname, port, document_url, **kw)
if "--test" in param_list:
output = unoconverter.convert("pdf")
if "--convert" in param_list and not '--getmetadata' in param_list \
and 'destination_format' not in locals():
output = unoconverter.convert()
......
......@@ -30,7 +30,7 @@ from signal import signal, SIGHUP
from application.openoffice import openoffice
from application.xvfb import xvfb
from wsgixmlrpcapplication import WSGIXMLRPCApplication
from utils import convertStringToBool, configureLogger, cleanDirectory
from utils import convertStringToBool, configureLogger
from os import path, mkdir
from sys import executable
from mimemapper import mimemapper
......@@ -105,7 +105,7 @@ def application(global_config, **local_config):
local_config.get('office_bin_path'),
local_config.get('uno_path'),
unoconverter_bin=unoconverter_bin,
python_path=local_config.get('python_path'),
python_path=executable,
unomimemapper_bin=unomimemapper_bin,
openoffice_tester_bin=openoffice_tester_bin)
openoffice.start()
......@@ -120,11 +120,13 @@ def application(global_config, **local_config):
mimemapper.loadFilterList(application_hostname,
openoffice_port,
unomimemapper_bin=unomimemapper_bin,
python_path=local_config.get('python_path'))
python_path=executable)
openoffice.release()
from manager import Manager
timeout_response = int(local_config.get('timeout_response'))
kw = dict(timeout=timeout_response, unoconverter_bin=unoconverter_bin)
kw = dict(timeout=timeout_response,
unoconverter_bin=unoconverter_bin,
python_path=executable)
cloudooo_manager = Manager(cloudooo_path_tmp_dir, **kw)
return WSGIXMLRPCApplication(instance=cloudooo_manager)
......@@ -29,8 +29,7 @@
from socket import socket, error
from errno import EADDRINUSE
from time import sleep
from os.path import join, isdir, exists
from os import listdir, remove
from os import remove
from shutil import rmtree
import logging
......
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