[FIX]Bug:bug fix and set error message for doc type files

bzr revid: sgo@tinyerp.com-20111219093156-yern0qjj3vz7gpsf
This commit is contained in:
Sanjay Gohel (Open ERP) 2011-12-19 15:01:56 +05:30
parent 0309ea7454
commit 560b296a3b
1 changed files with 9 additions and 3 deletions

View File

@ -95,9 +95,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:
import netsvc
logger = netsvc.Logger()
logger.notifyChannel("document", netsvc.LOG_ERROR, 'Please install Antiword package(MS Word reader): sudo apt-get install antiword')
return False
cntIndex.register(DocIndex())