diff options
| author | ssi <ssi@tinyerp.com> | 2010-11-18 16:08:32 +0530 |
|---|---|---|
| committer | ssi <ssi@tinyerp.com> | 2010-11-18 16:08:32 +0530 |
| commit | de7da549b43cb70afdc2410b60bc0e2fb3de33dc (patch) | |
| tree | c19145ed9e61adef2c3c509b5403e6261407e95f /addons/document/std_index.py | |
| parent | f4d2b79fa73c62063cd8ecf369fdb8b18c1e3333 (diff) | |
| parent | a5bd782fd11221c76836fd852fc5f99eabf888ce (diff) | |
Merged with lp:~openerp-dev/openobject-addons/trunk-dev-addons1
bzr revid: ssi@tinyerp.com-20101118103832-3meff0cd18v9p22o
Diffstat (limited to 'addons/document/std_index.py')
| -rw-r--r-- | addons/document/std_index.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/addons/document/std_index.py b/addons/document/std_index.py index 2a588a017c1..7cfcd36e2dc 100644 --- a/addons/document/std_index.py +++ b/addons/document/std_index.py @@ -96,8 +96,13 @@ class DocIndex(indexer): def _doIndexFile(self,fname): fp = Popen(['antiword', fname], shell=False, stdout=PIPE).stdout - return _to_unicode(fp.read()) - + try: + file_data = _to_unicode(fp.read()) + finally: + fp.close() + + return file_data + cntIndex.register(DocIndex()) class DocxIndex(indexer): @@ -158,7 +163,12 @@ class PdfIndex(indexer): def _doIndexFile(self,fname): fp = Popen(['pdftotext', '-enc', 'UTF-8', '-nopgbrk', fname, '-'], shell=False, stdout=PIPE).stdout - return _to_unicode( fp.read()) + try: + file_data = _to_unicode( fp.read()) + finally: + fp.close() + + return file_data cntIndex.register(PdfIndex()) |
