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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
cloudooo
Commits
07e26ff2
Commit
07e26ff2
authored
Feb 04, 2014
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support adding a new property in setMetadata.
parent
257be770
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
cloudooo/handler/ooo/helper/unoconverter.py
cloudooo/handler/ooo/helper/unoconverter.py
+8
-1
cloudooo/handler/ooo/tests/testOooServer.py
cloudooo/handler/ooo/tests/testOooServer.py
+5
-7
No files found.
cloudooo/handler/ooo/helper/unoconverter.py
View file @
07e26ff2
...
...
@@ -232,11 +232,18 @@ class UnoConverter(object):
"""
document_properties
=
self
.
document_loaded
.
getDocumentProperties
()
user_defined_properties
=
document_properties
.
getUserDefinedProperties
()
new_properties
=
[]
for
prop
,
value
in
metadata
.
items
():
for
container
in
[
document_properties
,
user_defined_properties
]:
if
getattr
(
container
,
prop
,
None
)
is
not
None
:
setattr
(
container
,
prop
,
value
)
container
break
else
:
new_properties
.
append
([
prop
,
value
])
for
prop
,
value
in
new_properties
:
if
isinstance
(
value
,
unicode
):
user_defined_properties
.
addProperty
(
prop
,
0
,
''
)
user_defined_properties
.
setPropertyValue
(
prop
,
value
)
self
.
document_loaded
.
store
()
self
.
document_loaded
.
dispose
()
...
...
cloudooo/handler/ooo/tests/testOooServer.py
View file @
07e26ff2
...
...
@@ -161,10 +161,9 @@ class TestServer(TestCase):
return
[
# Test server using method updateFileMetadata
(
join
(
'data'
,
'testMetadata.odt'
),
"odt"
,
dict
(
Title
=
'testSetMetadata'
)),
# XXX adding a custom metadata is not yet supported
# # Test server using method updateFileMetadata with unsual metadata
# (join('data', 'testMetadata.odt'), "odt", dict(Reference='testSet'+
# 'Metadata')),
# Test server using method updateFileMetadata with unsual metadata
(
join
(
'data'
,
'testMetadata.odt'
),
"odt"
,
dict
(
Reference
=
'testSet'
+
'Metadata'
)),
# Test document that already has metadata. Check if the metadata is
# not deleted, but updated
(
join
(
'data'
,
'testMetadata.odt'
),
"odt"
,
dict
(
Title
=
'cloudooo Title'
)),
...
...
@@ -187,9 +186,8 @@ class TestServer(TestCase):
self
.
assertEquals
(
self
.
_getFileType
(
new_odf_data
),
'application/vnd.oasis.opendocument.text'
)
metadata_dict
=
self
.
proxy
.
getFileMetadataItemList
(
new_odf_data
,
'odt'
)
# XXX adding a custom metadata is not yet supported
# self.assertEquals(metadata_dict.get("Reference"), "new value")
# self.assertEquals(metadata_dict.get("Something"), "ABC")
self
.
assertEquals
(
metadata_dict
.
get
(
"Reference"
),
"new value"
)
self
.
assertEquals
(
metadata_dict
.
get
(
"Something"
),
"ABC"
)
def
ConvertScenarioList
(
self
):
return
[
...
...
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