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
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
Roque
cloudooo
Commits
60a0b7f6
Commit
60a0b7f6
authored
8 years ago
by
Tristan Cavelier
Committed by
Cédric Le Ninivin
8 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x2t: implement get/setMetadata
parent
a2a0196f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
cloudooo/handler/x2t/handler.py
cloudooo/handler/x2t/handler.py
+24
-0
No files found.
cloudooo/handler/x2t/handler.py
View file @
60a0b7f6
...
@@ -36,6 +36,7 @@ from zope.interface import implements
...
@@ -36,6 +36,7 @@ from zope.interface import implements
from
cloudooo.interfaces.handler
import
IHandler
from
cloudooo.interfaces.handler
import
IHandler
from
cloudooo.file
import
File
from
cloudooo.file
import
File
from
cloudooo.util
import
logger
,
zipTree
,
unzip
,
parseContentType
from
cloudooo.util
import
logger
,
zipTree
,
unzip
,
parseContentType
from
cloudooo.handler.ooo.handler
import
Handler
as
OOoHandler
AVS_OFFICESTUDIO_FILE_UNKNOWN
=
"0"
AVS_OFFICESTUDIO_FILE_UNKNOWN
=
"0"
AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX
=
"65"
AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX
=
"65"
...
@@ -81,6 +82,9 @@ class Handler(object):
...
@@ -81,6 +82,9 @@ class Handler(object):
The source format of the inputed file
The source format of the inputed file
"""
"""
self
.
base_folder_url
=
base_folder_url
self
.
base_folder_url
=
base_folder_url
self
.
_data
=
data
self
.
_source_format
=
source_format
self
.
_init_kw
=
kw
self
.
file
=
File
(
base_folder_url
,
data
,
source_format
)
self
.
file
=
File
(
base_folder_url
,
data
,
source_format
)
self
.
environment
=
kw
.
get
(
"env"
,
{})
self
.
environment
=
kw
.
get
(
"env"
,
{})
...
@@ -160,6 +164,16 @@ class Handler(object):
...
@@ -160,6 +164,16 @@ class Handler(object):
"""Returns a dictionary with all metadata of document.
"""Returns a dictionary with all metadata of document.
along with the metadata.
along with the metadata.
"""
"""
# XXX Cloudooo takes the first handler that can "handle" source_mimetype.
# However, docx documents metadata can only be "handled" by the ooo handler.
# Handlers should provide a way to tell if such capability is available for the required source mimetype.
# We have to define a precise direction on how to know/get what are handlers capabilities according to Cloudooo configuration.
if
self
.
_source_format
in
(
"docx"
,
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
,
"xlsx"
,
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
,
"pptx"
,
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
,
):
return
OOoHandler
(
self
.
base_folder_url
,
self
.
_data
,
self
.
_source_format
,
**
self
.
_init_kw
).
getMetadata
(
base_document
)
raise
NotImplementedError
raise
NotImplementedError
def
setMetadata
(
self
,
metadata
=
{}):
def
setMetadata
(
self
,
metadata
=
{}):
...
@@ -167,6 +181,16 @@ class Handler(object):
...
@@ -167,6 +181,16 @@ class Handler(object):
Keyword arguments:
Keyword arguments:
metadata -- expected an dictionary with metadata.
metadata -- expected an dictionary with metadata.
"""
"""
# XXX Cloudooo takes the first handler that can "handle" source_mimetype.
# However, docx documents metadata can only be "handled" by the ooo handler.
# Handlers should provide a way to tell if such capability is available for the required source mimetype.
# We have to define a precise direction on how to know/get what are handlers capabilities according to Cloudooo configuration.
if
self
.
_source_format
in
(
"docx"
,
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
,
"xlsx"
,
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
,
"pptx"
,
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
,
):
return
OOoHandler
(
self
.
base_folder_url
,
self
.
_data
,
self
.
_source_format
,
**
self
.
_init_kw
).
setMetadata
(
metadata
)
raise
NotImplementedError
raise
NotImplementedError
@
staticmethod
@
staticmethod
...
...
This diff is collapsed.
Click to expand it.
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