summaryrefslogtreecommitdiff
path: root/addons/document/std_index.py
diff options
context:
space:
mode:
authorThibault Delavallée <tde@openerp.com>2011-12-19 16:10:01 +0100
committerThibault Delavallée <tde@openerp.com>2011-12-19 16:10:01 +0100
commit5a2d37d47ccb2f25089d27f34a5ac683264e16d7 (patch)
tree1054c20768cef3af43885f063419b96ad2cc771e /addons/document/std_index.py
parent75409e349a0ca4488e477b9621991145e6890d5c (diff)
parent560b296a3b58f81a48da386deaf73f52c4890632 (diff)
[MERGE] document: fixed bug 905279 : catching error when antiword not installed for doc file indexing
bzr revid: tde@openerp.com-20111219151001-rcj2qdji5a3z63k3
Diffstat (limited to 'addons/document/std_index.py')
-rw-r--r--addons/document/std_index.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/addons/document/std_index.py b/addons/document/std_index.py
index fe42cfb1795..e153d018bf0 100644
--- a/addons/document/std_index.py
+++ b/addons/document/std_index.py
@@ -24,6 +24,7 @@ from subprocess import Popen, PIPE
import StringIO
import odt2txt
import sys, zipfile, xml.dom.minidom
+import logging
def _to_unicode(s):
try:
@@ -95,9 +96,15 @@ class DocIndex(indexer):
return ['.doc']
def _doIndexFile(self,fname):
- pop = Popen(['antiword', fname], shell=False, stdout=PIPE)
- (data, _) = pop.communicate()
- return _to_unicode(data)
+ try:
+ pop = Popen(['antiword', fname], shell=False, stdout=PIPE)
+ (data, _) = pop.communicate()
+ return _to_unicode(data)
+ except OSError:
+ logger = logging.getLogger('document.DocIndex')
+ logger.warn("Failed attempt to execute antiword (MS Word reader). Antiword is necessary to index the file %s of MIME type %s. Detailed error available at DEBUG level.", fname, self._getMimeTypes()[0])
+ logger.debug("Trace of the failed file indexing attempt: ", exc_info=True)
+ return False
cntIndex.register(DocIndex())