Commit 3efb4935 authored by Hugo H. Maia Vieira's avatar Hugo H. Maia Vieira

Refactor getFile. Now returns an empty string for not existent file


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@41115 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8f109731
......@@ -163,8 +163,8 @@ class OdfDocument(object):
return self._zipfile.read('content.xml')
def getFile(self, path):
"""If exists, returns file as string, else return None"""
"""If exists, returns file as string, else return an empty string"""
try:
return self._zipfile.read(path)
except KeyError:
return None
return ''
......@@ -55,7 +55,7 @@ class TestOdfDocument(cloudoooTestCase):
def testGetNotPresentFile(self):
"""Test if the getFile method returns None for not present file request"""
requested_file = self.oodocument.getFile('not_present.xml')
self.assertEquals(requested_file, None)
self.assertEquals(requested_file, '')
def testParseContent(self):
"""Test if the _parsed_content attribute is the parsed content.xml"""
......
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