Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
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
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
Tristan Cavelier
cloudooo
Commits
5ed8286e
Commit
5ed8286e
authored
Nov 25, 2016
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
logging
parent
574a94cb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
8 deletions
+24
-8
cloudooo/manager.py
cloudooo/manager.py
+24
-8
No files found.
cloudooo/manager.py
View file @
5ed8286e
...
...
@@ -115,18 +115,24 @@ class Manager(object):
zip -- Boolean Attribute. If true, returns the file in the form of a
zip archive
"""
self
.
kw
[
'zip'
]
=
zip
self
.
kw
[
'refresh'
]
=
refresh
handler_class
=
getHandlerClass
(
source_format
,
log
(
"TRISTAN convertFile %r - %r"
%
(
source_format
,
destination_format
))
try
:
self
.
kw
[
'zip'
]
=
zip
self
.
kw
[
'refresh'
]
=
refresh
handler_class
=
getHandlerClass
(
source_format
,
destination_format
,
self
.
mimetype_registry
,
self
.
handler_dict
)
handler
=
handler_class
(
self
.
_path_tmp_dir
,
handler
=
handler_class
(
self
.
_path_tmp_dir
,
decodestring
(
file
),
source_format
,
**
self
.
kw
)
decode_data
=
handler
.
convert
(
destination_format
,
**
conversion_kw
)
return
encodestring
(
decode_data
)
decode_data
=
handler
.
convert
(
destination_format
,
**
conversion_kw
)
return
encodestring
(
decode_data
)
except
Exception
,
e
:
import
traceback
log
(
"TRISTAN convertFile - %s"
%
(
traceback
.
format_exc
(),))
raise
e
def
updateFileMetadata
(
self
,
file
,
source_format
,
metadata_dict
):
"""Receives the string of document and a dict with metadatas. The metadata
...
...
@@ -136,6 +142,7 @@ class Manager(object):
{"title":"abc","description":...})
return encodestring(document_with_metadata)
"""
log
(
"TRISTAN updateFileMetadata %r"
%
(
source_format
,))
handler_class
=
getHandlerClass
(
source_format
,
None
,
self
.
mimetype_registry
,
...
...
@@ -163,6 +170,7 @@ class Manager(object):
Note that all keys of the dictionary have the first word in uppercase.
"""
log
(
"TRISTAN getFileMetadataItemList %r"
%
(
source_format
,))
handler_class
=
getHandlerClass
(
source_format
,
None
,
self
.
mimetype_registry
,
...
...
@@ -190,6 +198,7 @@ class Manager(object):
if
not
mimetype
:
if
extension
:
mimetype
,
_
=
BBB_guess_type
(
"a."
+
extension
)
log
(
"TRISTAN getAllowedExtensionList guessing type of %r -> %r"
%
(
extension
,
mimetype
))
elif
document_type
:
# BBB no other choice than to ask ooo.mimemapper
return
mimemapper
.
getAllowedExtensionList
(
document_type
=
document_type
)
...
...
@@ -199,8 +208,10 @@ class Manager(object):
ext
=
BBB_guess_extension
(
content_type
,
title
)
if
ext
:
allowed_extension_set
.
add
((
ext
.
lstrip
(
'.'
),
title
))
log
(
"TRISTAN getAllowedExtensionList for %r -> %r"
%
(
mimetype
,
list
(
allowed_extension_set
)))
return
list
(
allowed_extension_set
)
or
[(
''
,
''
)]
else
:
log
(
"TRISTAN getAllowedExtensionList for / -> %r"
%
(
list
(
allowed_extension_set
),))
return
[(
''
,
''
)]
def
getAllowedConversionFormatList
(
self
,
source_mimetype
):
...
...
@@ -239,6 +250,7 @@ class Manager(object):
output_mimetype_set
.
add
(
output_mimetype
)
break
log
(
"TRISTAN getAllowedConversionFormatList for %r -> %r"
%
(
source_mimetype
,
list
(
output_mimetype_set
)))
return
list
(
output_mimetype_set
)
def
run_convert
(
self
,
filename
=
''
,
data
=
None
,
meta
=
None
,
extension
=
None
,
...
...
@@ -248,6 +260,7 @@ class Manager(object):
This is a Backwards compatibility provided for ERP5 Project, in order to
keep compatibility with OpenOffice.org Daemon.
"""
log
(
"TRISTAN run_convert from %r to %r"
%
(
orig_format
,
extension
))
if
not
extension
:
extension
=
filename
.
split
(
'.'
)[
-
1
]
try
:
...
...
@@ -273,6 +286,7 @@ class Manager(object):
This is a Backwards compatibility provided for ERP5 Project, in order to
keep compatibility with OpenOffice.org Daemon.
"""
log
(
"TRISTAN run_setmetadata from %r to %r"
%
(
orig_format
,
extension
))
if
not
extension
:
extension
=
filename
.
split
(
'.'
)[
-
1
]
response_dict
=
{}
...
...
@@ -289,6 +303,7 @@ class Manager(object):
This is a Backwards compatibility provided for ERP5 Project, in order to
keep compatibility with OpenOffice.org Daemon.
"""
log
(
"TRISTAN run_getmetadata from %r to %r"
%
(
orig_format
,
extension
))
if
not
extension
:
extension
=
filename
.
split
(
'.'
)[
-
1
]
response_dict
=
{}
...
...
@@ -308,6 +323,7 @@ class Manager(object):
This is a Backwards compatibility provided for ERP5 Project, in order
to keep compatibility with OpenOffice.org Daemon.
"""
log
(
"TRISTAN run_generate from %r to %r"
%
(
orig_format
,
extension
))
# calculate original extension required by convertFile from
# given content_type (orig_format)
original_extension
=
BBB_guess_extension
(
orig_format
).
strip
(
'.'
)
...
...
@@ -348,7 +364,7 @@ class Manager(object):
This is a Backwards compatibility provided for ERP5 Project, in order to
keep compatibility with OpenOffice.org Daemon.
"""
#log("TRISTAN atil"
)
log
(
"TRISTAN getAllowedTargetItemList of %r"
%
(
content_type
,)
)
response_dict
=
{}
try
:
mimetype_list
=
self
.
getAllowedConversionFormatList
(
content_type
)
...
...
@@ -362,7 +378,7 @@ class Manager(object):
except
Exception
,
e
:
logger
.
error
(
e
)
import
traceback
log
(
"TRISTAN %s"
%
traceback
.
format_exc
())
log
(
"TRISTAN
getAllowedTargetItemList
%s"
%
traceback
.
format_exc
())
return
(
402
,
{},
e
.
args
[
0
])
def
_getOOGranulator
(
self
,
data
,
source_format
=
"odt"
):
...
...
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