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