diff options
Diffstat (limited to 'mammoth')
| -rw-r--r-- | mammoth/__init__.py | 4 | ||||
| -rw-r--r-- | mammoth/results.py | 6 |
2 files changed, 4 insertions, 6 deletions
diff --git a/mammoth/__init__.py b/mammoth/__init__.py index 1fca3d6..92278f7 100644 --- a/mammoth/__init__.py +++ b/mammoth/__init__.py @@ -3,6 +3,4 @@ from . import docx, conversion def convert_to_html(fileobj): - document = docx.read(fileobj).value - html = conversion.convert_document_element_to_html(document).value - return Result(html, []) + return docx.read(fileobj).bind(conversion.convert_document_element_to_html) diff --git a/mammoth/results.py b/mammoth/results.py index ab29b25..b4bedbd 100644 --- a/mammoth/results.py +++ b/mammoth/results.py @@ -9,9 +9,9 @@ class Result(object): def map(self, func): return Result(func(self.value), self.messages) - #~ def bind(self, func): - #~ result = func(self.value) - #~ return Result(result.value, self.messages + result.messages) + def bind(self, func): + result = func(self.value) + return Result(result.value, self.messages + result.messages) Message = collections.namedtuple("Message", ["type", "message"]) |
