Commit f281ea03 authored by Gabriel Monnerat's avatar Gabriel Monnerat

Fix issue to get mime type to ms.xlsx format. In this case, the format is...

Fix issue to get mime type to ms.xlsx format. In this case, the format is splitted to try select a generic format
parent 04d2b1e8
......@@ -303,6 +303,20 @@ class TestServer(TestCase):
if exists(output_url):
remove(output_url)
def testRunGenerateMethodConvertOdsToMsXslx(self):
"""Test run_generate method from ods to ms.xlsx. This test is to validate
a bug convertions to html"""
generate_result = self.proxy.run_generate('test.ods',
encodestring(
open(join('data', 'test.ods')).read()),
None, 'ms.xlsx',
"application/vnd.oasis.opendocument.spreadsheet")
response_code, response_dict, response_message = generate_result
self.assertEquals(response_code, 200)
self.assertEquals(type(response_dict), DictType)
self.assertNotEquals(response_dict['data'], '')
self.assertEquals(response_dict['mime'], 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
# XXX: This is a test for ERP5 Backward compatibility,
# and the support to this kind of tests will be dropped.
def testPNGFileToConvertOdpToHTML(self):
......
......@@ -268,7 +268,8 @@ class Manager(object):
elif extension == 'xhtml':
response_dict['mime'] = "text/html"
else:
response_dict['mime'] = mimetypes.types_map.get('.%s' % extension)
response_dict['mime'] = mimetypes.types_map.get('.%s' % extension,
mimetypes.types_map.get('.%s' % extension.split('.')[-1]))
return (200, response_dict, "")
except Exception, e:
logger.error(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