Commit b91e43a3 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

add ooo_disable_filter_list option, a list of filters by Name which are disabled.

parent 939f117a
......@@ -250,6 +250,7 @@ def bootstrapHandler(configuration_dict):
kw = dict(uno_path=configuration_dict.get('uno_path'),
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'))
# Load all filters
......
......@@ -95,7 +95,8 @@ 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
ooo_disable_filter_list -- a list of filters by Name which are disabled
ooo_disable_filter_name_list -- a list of filters by UI Name which are disabled
"""
alternative_extension_dict = {
'Microsoft Excel 2007 XML':'ms.xlsx',
......@@ -133,11 +134,17 @@ class MimeMapper(object):
raise ValueError(stdout)
filter_dict, type_dict = json.loads(stdout)
ooo_disable_filter_list = kw.get("ooo_disable_filter_list") or [] + [
'writer_jpg_Export', # Seems not working from cloudooo in Libre Office 4.2.0.4.
'writer_png_Export', # Seems not working from cloudooo in Libre Office 4.2.0.4.
]
ooo_disable_filter_name_list = kw.get("ooo_disable_filter_name_list") or [] + [
'Text', # Use 'Text Encoded' instead
'Text (StarWriter/Web)', # Use 'Text Encoded (Writer/Web)' instead
]
for filter_name, value in filter_dict.iteritems():
if filter_name in ooo_disable_filter_list:
continue
ui_name = value.get('UIName')
filter_type = value.get('Type')
filter_type_dict = type_dict.get(filter_type)
......
......@@ -80,6 +80,13 @@ def application(global_config, **local_config):
local_config["mimetype_registry"] = handler_mapping_list = \
filter(None, mimetype_registry.split("\n"))
ooo_disable_filter_list = []
for filter_name in local_config.get("ooo_disable_filter_list", "").split("\n"):
filter_name = filter_name.strip()
if filter_name and not filter_name in ooo_disable_filter_list:
ooo_disable_filter_list.append(filter_name)
local_config["ooo_disable_filter_list"] = ooo_disable_filter_list
ooo_disable_filter_name_list = []
for filter_name in local_config.get("ooo_disable_filter_name_list", "").split("\n"):
filter_name = filter_name.strip()
......
......@@ -55,13 +55,19 @@ mimetype_registry =
* application/vnd.oasis.opendocument* ooo
# This is used to disable ooo filters
# Below is an example list of spreadsheet filter names.
#
# Below is an example list of spreadsheet filters by UI Name.
# http://wiki.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Filter_Options
#ooo_disable_filter_name_list =
# Microsoft Excel 5.0
# Microsoft Excel 95
# Microsoft Word 6.0
# Microsoft Word 95
#
# Below is an example list of some filters by Name.
#ooo_disable_filter_list =
# writer_jpg_Export
# writer_png_Export
[server:main]
use = egg:PasteScript#wsgiutils
......
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