Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
cloudooo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Tyagov
cloudooo
Commits
a9e11c18
Commit
a9e11c18
authored
Apr 11, 2013
by
Gabriel Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor code to consider UI Name instead of filter name in blacklisted filters.
parent
dc619e90
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
18 deletions
+14
-18
cloudooo/handler/ooo/mimemapper.py
cloudooo/handler/ooo/mimemapper.py
+10
-16
cloudooo/sample/sample.conf
cloudooo/sample/sample.conf
+4
-2
No files found.
cloudooo/handler/ooo/mimemapper.py
View file @
a9e11c18
...
...
@@ -99,12 +99,9 @@ class MimeMapper(object):
"""
alternative_extension_dict
=
{
'Microsoft Excel 2007/2010 XML'
:
'ms.xlsx'
,
'Microsoft Excel 5.0 Template'
:
'5.xlt'
,
'Microsoft Excel 5.0'
:
'5.xls'
,
'Microsoft Excel 95 Template'
:
'95.xlt'
,
'Microsoft Excel 95'
:
'95.xls'
,
'Microsoft PowerPoint 2007/2010 XML AutoPlay'
:
'ms.ppsx'
,
'Microsoft PowerPoint 2007/2010 XML Template'
:
'ms.potm'
,
'Microsoft PowerPoint 2007/2010 XML'
:
'ms.pptx'
,
'Microsoft Word 2007/2010 XML'
:
'ms.docx'
,
'Microsoft Word 6.0'
:
'6.doc'
,
...
...
@@ -128,15 +125,17 @@ class MimeMapper(object):
raise
ValueError
(
stdout
)
filter_dict
,
type_dict
=
json
.
loads
(
stdout
)
ooo_disable_filter_name_list
=
kw
.
get
(
"ooo_disable_filter_name_list"
)
or
()
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_name_list
:
continue
# Hardcode blacklisted filters
if
filter_name
in
[
'Text'
,
# Use 'Text (encoded)' instead
'Text (StarWriter/Web)'
,
# Use 'Text (encoded) (StarWriter/Web)' instead
]:
ui_name
=
value
.
get
(
'UIName'
)
filter_type
=
value
.
get
(
'Type'
)
filter_type_dict
=
type_dict
.
get
(
filter_type
)
if
not
ui_name
:
ui_name
=
filter_type_dict
.
get
(
"UIName"
)
if
ui_name
in
ooo_disable_filter_name_list
or
'Template'
in
ui_name
:
continue
flag
=
value
.
get
(
"Flags"
)
# http://api.openoffice.org/docs/DevelopersGuide/OfficeDev/OfficeDev.xhtml#1_2_4_2_10_Properties_of_a_Filter
...
...
@@ -147,11 +146,6 @@ class MimeMapper(object):
# ThirdParty:0x80000, Preferred:0x10000000
if
flag
&
0x08
or
flag
&
0x1000
or
flag
&
0x2000
:
continue
ui_name
=
value
.
get
(
'UIName'
)
filter_type
=
value
.
get
(
'Type'
)
filter_type_dict
=
type_dict
.
get
(
filter_type
)
if
not
ui_name
:
ui_name
=
filter_type_dict
.
get
(
"UIName"
)
filter_extension_list
=
filter_type_dict
.
get
(
"Extensions"
)
mimetype
=
filter_type_dict
.
get
(
"MediaType"
)
if
not
(
filter_extension_list
and
mimetype
):
...
...
cloudooo/sample/sample.conf
View file @
a9e11c18
...
...
@@ -58,8 +58,10 @@ mimetype_registry =
# 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
# Microsoft Excel 5.0
# Microsoft Excel 95
# Microsoft Word 6.0
# Microsoft Word 95
[
server
:
main
]
use
=
egg
:
PasteScript
#wsgiutils
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment