diff options
| author | uco (OpenERP) <uco@tinyerp.com> | 2010-12-06 18:41:02 +0530 |
|---|---|---|
| committer | uco (OpenERP) <uco@tinyerp.com> | 2010-12-06 18:41:02 +0530 |
| commit | b1cf433ecc01a58c8abe27fdf9dbaba2deedf7f5 (patch) | |
| tree | 7d4b2df75b76c3529854cf98c401ad59370ce00a /addons/document/std_index.py | |
| parent | eb04af83f31615e220a1b5e9639e799eb88242d6 (diff) | |
| parent | 5350ab0c1930e6573ee52bd430bb1d0f5adea2a3 (diff) | |
[MERGE]: Merged with trunk-addons.
bzr revid: uco@tinyerp.com-20101206131102-z2xzz8eshkswo00q
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()) |
