From d217272611da605662aa8df6a6e94271a7cfeba3 Mon Sep 17 00:00:00 2001 From: "Ysa (Open ERP)" Date: Thu, 11 Mar 2010 14:26:00 +0530 Subject: [PATCH] [IMP] document :- support indexation of .docx to text and PPTX to html bzr revid: ysa@tinyerp.co.in-20100311085600-4t4gmuzywglpugh0 --- addons/document/std_index.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/addons/document/std_index.py b/addons/document/std_index.py index bd61c65e16b..b54ff396480 100644 --- a/addons/document/std_index.py +++ b/addons/document/std_index.py @@ -21,7 +21,7 @@ import StringIO import odt2txt - +from subprocess import Popen, PIPE from content_index import indexer, cntIndex @@ -50,15 +50,28 @@ class TxtIndex(indexer): cntIndex.register(TxtIndex()) +class PptIndex(indexer): + def _getMimeTypes(self): + return [ 'application/ms-word'] + + def _getExtensions(self): + return ['.ppt','.pptx'] + + def _doIndexFile(self,fname): + fp = Popen(['ppthtml', fname], shell=False, stdout=PIPE).stdout + return _to_unicode( fp.read()) + +cntIndex.register(PptIndex()) + class DocIndex(indexer): def _getMimeTypes(self): return [ 'application/ms-word'] def _getExtensions(self): - return ['.doc'] + return ['.doc','.docx'] def _doIndexFile(self,fname): - fp = Popen(['antiword',fname], shell=False, stdout=PIPE).stdout + fp = Popen(['antiword', fname], shell=False, stdout=PIPE).stdout return _to_unicode( fp.read()) cntIndex.register(DocIndex())