Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kasra Jamshidi
slapos
Commits
26165589
Commit
26165589
authored
Jun 21, 2016
by
Tristan Cavelier
Committed by
Rafael Monnerat
Jun 23, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add mimetype_entry_addition parameter to the generic_cloudooo recipe
parent
74d92074
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
25 deletions
+55
-25
slapos/recipe/generic_cloudooo/__init__.py
slapos/recipe/generic_cloudooo/__init__.py
+54
-0
slapos/recipe/generic_cloudooo/template/cloudooo.cfg.in
slapos/recipe/generic_cloudooo/template/cloudooo.cfg.in
+1
-25
No files found.
slapos/recipe/generic_cloudooo/__init__.py
View file @
26165589
...
...
@@ -27,6 +27,51 @@
import
zc.buildout
from
slapos.recipe.librecipe
import
GenericBaseRecipe
def
compareMimetypeEntryPair
(
a
,
b
):
"""
Like comparing strings, but here the star `*` is stronger than any other
character.
"""
i
=
0
for
i
in
range
(
min
(
len
(
a
),
len
(
b
))):
if
a
[
i
]
!=
b
[
i
]:
if
a
[
i
]
==
"*"
:
return
1
if
b
[
i
]
==
"*"
:
return
-
1
if
a
[
i
]
<
b
[
i
]:
return
-
1
if
a
[
i
]
>
b
[
i
]:
return
1
return
0
if
a
[
i
:
i
+
1
]:
return
1
if
b
[
i
:
i
+
1
]:
return
-
1
return
0
default_mimetype_entry_list
=
[
"application/vnd.oasis.opendocument* * ooo"
,
"application/vnd.sun.xml* * ooo"
,
"application/pdf text/* pdf"
,
"application/pdf * ooo"
,
"video/* * ffmpeg"
,
"audio/* * ffmpeg"
,
"application/x-shockwave-flash * ffmpeg"
,
"application/ogg * ffmpeg"
,
"application/ogv * ffmpeg"
,
"image/png image/jpeg imagemagick"
,
"image/png * ooo"
,
"image/* image/* imagemagick"
,
"text/* * ooo"
,
"application/zip * ooo"
,
"application/msword * ooo"
,
"application/vnd* * ooo"
,
"application/x-vnd* * ooo"
,
"application/postscript * ooo"
,
"application/wmf * ooo"
,
"application/csv * ooo"
,
"application/x-openoffice-gdimetafile * ooo"
,
"application/x-emf * ooo"
,
"application/emf * ooo"
,
"application/octet* * ooo"
,
"* application/vnd.oasis.opendocument* ooo"
,
]
class
Recipe
(
GenericBaseRecipe
):
def
install
(
self
):
path_list
=
[]
...
...
@@ -52,6 +97,15 @@ class Recipe(GenericBaseRecipe):
conversion_server_dict
[
'ENVIRONMENT_VARIABLE_LIST'
]
=
'
\
n
'
.
join
(
[
'env-%s = %s'
%
(
key
,
value
)
for
key
,
value
in
environment_variable_list
]
)
mimetype_entry_list
=
[
l
.
strip
()
for
l
in
self
.
options
.
get
(
'mimetype_entry_addition'
,
''
).
splitlines
()
if
l
and
not
l
.
isspace
()
]
mimetype_entry_list
.
extend
(
default_mimetype_entry_list
)
mimetype_entry_list
.
sort
(
compareMimetypeEntryPair
)
conversion_server_dict
[
'MIMETYPE_ENTRY_LIST'
]
=
\
"
\
n
"
.
join
([
" "
+
l
for
l
in
mimetype_entry_list
])
config_file
=
self
.
createFile
(
self
.
options
[
'configuration-file'
],
self
.
substituteTemplate
(
self
.
getTemplateFilename
(
'cloudooo.cfg.in'
),
conversion_server_dict
))
...
...
slapos/recipe/generic_cloudooo/template/cloudooo.cfg.in
View file @
26165589
...
...
@@ -42,31 +42,7 @@ openoffice_port = %(openoffice_port)s
# It is used to select the handler that will be used in conversion.
# Priority matters, first match take precedence on next lines.
mimetype_registry =
application/vnd.oasis.opendocument* * ooo
application/vnd.sun.xml* * ooo
application/pdf text/* pdf
application/pdf * ooo
video/* * ffmpeg
audio/* * ffmpeg
application/x-shockwave-flash * ffmpeg
application/ogg * ffmpeg
application/ogv * ffmpeg
image/png image/jpeg imagemagick
image/png * ooo
image/* image/* imagemagick
text/* * ooo
application/zip * ooo
application/msword * ooo
application/vnd* * ooo
application/x-vnd* * ooo
application/postscript * ooo
application/wmf * ooo
application/csv * ooo
application/x-openoffice-gdimetafile * ooo
application/x-emf * ooo
application/emf * ooo
application/octet* * ooo
* application/vnd.oasis.opendocument* ooo
%(MIMETYPE_ENTRY_LIST)s
[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