Commit d6c10a41 authored by Yusei Tahara's avatar Yusei Tahara

Add ooo_disable_filter_name_list option to disable ooo filter. This is useful...

Add ooo_disable_filter_name_list option to disable ooo filter. This is useful when you want to prevent unnecessary filters to be used.
parent 168786a4
......@@ -249,7 +249,8 @@ def bootstrapHandler(configuration_dict):
timeout_response = int(configuration_dict.get('timeout_response'))
kw = dict(uno_path=configuration_dict.get('uno_path'),
office_binary_path=configuration_dict.get('office_binary_path'),
timeout=timeout_response)
timeout=timeout_response,
ooo_disable_filter_name_list=configuration_dict.get('ooo_disable_filter_name_list'))
# Load all filters
openoffice.acquire()
......
......@@ -95,6 +95,7 @@ class MimeMapper(object):
**kw:
uno_path -- full path to uno library
office_binary_path -- full path to openoffice binary
ooo_disable_filter_name_list -- a list of filter names which are disabled
"""
uno_path = kw.get("uno_path", environ.get('uno_path'))
office_binary_path = kw.get("office_binary_path",
......@@ -113,7 +114,11 @@ class MimeMapper(object):
if process.returncode:
raise ValueError(stdout)
filter_dict, type_dict = json.loads(stdout)
ooo_disable_filter_name_list = kw.get("ooo_disable_filter_name_list") or ()
for filter_name, value in filter_dict.iteritems():
if filter_name in ooo_disable_filter_name_list:
continue
flag = value.get("Flags")
# http://api.openoffice.org/docs/DevelopersGuide/OfficeDev/OfficeDev.xhtml#1_2_4_2_10_Properties_of_a_Filter
# Import:0x01, Export:0x02, Template:0x04, Internal:0x08,
......
......@@ -79,6 +79,14 @@ def application(global_config, **local_config):
mimetype_registry = local_config.get("mimetype_registry", "")
local_config["mimetype_registry"] = handler_mapping_list = \
filter(None, mimetype_registry.split("\n"))
ooo_disable_filter_name_list = []
for filter_name in local_config.get("ooo_disable_filter_name_list", "").split("\n"):
filter_name = filter_name.strip()
if filter_name and not filter_name in ooo_disable_filter_name_list:
ooo_disable_filter_name_list.append(filter_name)
local_config["ooo_disable_filter_name_list"] = ooo_disable_filter_name_list
handler_dict = {}
for line in handler_mapping_list:
input_mimetype, output_mimetype, handler = line.strip().split()
......
......@@ -54,6 +54,13 @@ mimetype_registry =
video/* * ffmpeg
* application/vnd.oasis.opendocument* ooo
# This is used to disable ooo filters
# Below is an example list of spreadsheet filter names.
# http://wiki.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Filter_Options
#ooo_disable_filter_name_list =
# MS Excel 95
# MS Excel 5.0/95
[server:main]
use = egg:PasteScript#wsgiutils
host = 0.0.0.0
......
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