summaryrefslogtreecommitdiff
path: root/addons/document/std_index.py
diff options
context:
space:
mode:
authorDharti Ratani (Open ERP) <dhr@tinyerp.com>2013-03-18 17:21:47 +0530
committerDharti Ratani (Open ERP) <dhr@tinyerp.com>2013-03-18 17:21:47 +0530
commitd9f1dbd38f44d610bcd0a2c31432c4ac77f2e667 (patch)
tree26ec90e662dcd32c8ac64f660a519cee0ea17efd /addons/document/std_index.py
parent7ba1c001491333c0ee5c6cc36728cb2ec95d9c63 (diff)
parent4ce8d2697d47f5fef279985a78059e34bee6f3ba (diff)
[Merge]Merged with trunk
bzr revid: dhr@tinyerp.com-20130318115147-iif7gjyoz7nqrbp8
Diffstat (limited to 'addons/document/std_index.py')
-rw-r--r--addons/document/std_index.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/addons/document/std_index.py b/addons/document/std_index.py
index b20874e72f8..dda776b1ec3 100644
--- a/addons/document/std_index.py
+++ b/addons/document/std_index.py
@@ -105,7 +105,7 @@ class DocIndex(indexer):
_logger.warning("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
+ return u''
cntIndex.register(DocIndex())
@@ -166,9 +166,14 @@ class PdfIndex(indexer):
return ['.pdf']
def _doIndexFile(self, fname):
- pop = Popen(['pdftotext', '-enc', 'UTF-8', '-nopgbrk', fname, '-'], shell=False, stdout=PIPE)
- (data, _) = pop.communicate()
- return _to_unicode(data)
+ try:
+ pop = Popen(['pdftotext', '-enc', 'UTF-8', '-nopgbrk', fname, '-'], shell=False, stdout=PIPE)
+ (data, _) = pop.communicate()
+ return _to_unicode(data)
+ except OSError:
+ _logger.warning("Failed attempt to execute pdftotext. This program 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 u''
cntIndex.register(PdfIndex())