Commit e1b62e3d authored by Ivan Tyagov's avatar Ivan Tyagov

Rather than simply raise return empty list for list of possible export formats...

Rather than simply raise return empty list for list of possible export formats for empty documents. Add test to cover this use case.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38695 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4af85dc2
...@@ -175,7 +175,8 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi ...@@ -175,7 +175,8 @@ class OOoDocument(OOoDocumentExtensibleTraversableMixin, BaseConvertableFileMixi
to provide an extensive list of conversion formats. to provide an extensive list of conversion formats.
""" """
if not self.hasBaseData(): if not self.hasBaseData():
raise NotConvertedError # if we have no date we can not format it
return []
def cached_getTargetFormatItemList(content_type): def cached_getTargetFormatItemList(content_type):
server_proxy = self._mkProxy() server_proxy = self._mkProxy()
......
...@@ -1928,6 +1928,21 @@ return 1 ...@@ -1928,6 +1928,21 @@ return 1
content_type='image/png') content_type='image/png')
self.assertTrue('txt' in image.getTargetFormatList()) self.assertTrue('txt' in image.getTargetFormatList())
# test Not converted (i.e. empty) OOoDocument instances
presentation=self.portal.document_module.newContent(portal_type='Presentation')
self.assertSameSet([], presentation.getTargetFormatList())
# test uploading some data
upload_file = makeFileUpload('Foo_001.odg')
presentation.edit(file=upload_file)
self.stepTic()
self.assertTrue('odg' in presentation.getTargetFormatList())
self.assertTrue('jpg' in presentation.getTargetFormatList())
self.assertTrue('png' in presentation.getTargetFormatList())
def test_convertToImageOnTraversal(self): def test_convertToImageOnTraversal(self):
""" """
Test converting to image all Document portal types on traversal i.e.: Test converting to image all Document portal types on traversal i.e.:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment